Coding a game

Hello dear programmers, I need your help. I have to program the following game for my computer science class: Alien Encounter is a game in which the player controls a character who is attacked by aliens. The aliens appear randomly and fly toward the character. When the character is touched by the aliens, they lose a life (the player starts with three lives). The goal is to avoid the aliens and shoot them down. For every second survived (without losing all three lives), the player earns one point. The game is won when the player reaches 60 points. Has anyone ever programmed a similar game, and does anyone know how it could be done? Time is running out, it would be very kind if someone could help.

you would start abstract,conceptional
sub class a canvas to paint your sprites with the help of a timer
few classes
player & input
interface for common methods

btw AppGameKit or GameMaker could be a better choice.

As Markus said, it can be done, but you have to do everything from scratch. For your case is better to find a proper game engine.

1 Like

Thanks for the answers.Unfortunatly I have to code this in XOJO. I‘ll try my best and i‘ll share the progress.

may be you could start from here and adapt the code for your needs

the code is here, the link on the blog does not work anymore

basically you translate your text to properties, methods, conditions.

as example Game.Tick called by timer make canvas invalidate (refresh), in paint event draw your sprites.

for each alien as Alien in Aliens
for each player as Player in Players

means the game class have a list of Aliens, alien have a draw method.
if you will draw an alien you will see that you need a position and picture property.

The SpaceRocks and Tank example games included with Xojo both demonstrate techniques for moving objects around the screen and shooting at things.

In addition, this multi-part blog/video series might also be helpful:

Can you update the links to the project parts on the blog from http to https? Using Chrome if you click on http link from an https page it does nothing. Thanks.

Hello, here is my attempt to create a little game
with Pixmapshape as sprite

1 Like

Thanks this is really helpful, i’ll start from there

My mentor told me to code this in XOJO 2018 release 2. Is this even possible? I think I might have to use a newer version of XOJO

I found another game to try
Mac -

Hi Rudolf thanks for this game. I have added a few things to it but I am trying to simplify your version. Can you help me by sending me a simplified verision of it? There should be only one character that moves towards the mouse cursor, and enemies that spawn from anywhere. You should only be able to dodge and shoot.

Hate to be that guy, but this forum isn’t here to do your homework for you. You’ll learn to program best through trial and error. Take the examples that people have generously created for you and use them to learn. If you break something and can’t figure out how to fix it, or get to a point where you are stuck on a particular piece, come back and ask specific questions and I’m sure people will be happy to help.