Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Asteroid Generation code

Author
Message
Beanboyblue
8
Years of Service
User Offline
Joined: 12th Oct 2015
Location:
Posted: 12th Oct 2015 13:56
I am trying to make a simple asteroid type game clone, i have created the movement for the ship relatively well, but i have absolutely no idea where to start when making the asteroid code. Please help, and thank you in advance.
Beanboyblue
8
Years of Service
User Offline
Joined: 12th Oct 2015
Location:
Posted: 12th Oct 2015 14:02
Need help with asteroid generation code, i cant see if my first post went through so i'm making a reply to my own thread. but basically i made the player movement part for a basic asteroids game, but i don't know how to make the asteroids be randomly generated off screen then float in. any and all help would be greatly appreciated.
Uncle Martin
17
Years of Service
User Offline
Joined: 9th Jul 2006
Location: Tampa, Florida, USA
Posted: 13th Oct 2015 06:36
BeanBoyblue, I have a few ideas for you. Would you mind posting your code, so that I can see what level you are at?

Anyway, as I am sure you are aware, the key is to randomize a few parameters for a lot of objects. I would suggest you create a structure that has the parameters for your asteroids, then declare an array of that structure. Next loop thru the members, initializing the parameters with randomized values. Then enter your game loop where you animate & display all the asteroids along with your Hero ship. Obviously you will have to evolve & destroy the asteroids too. I have sample code ready that demonstrates all that, but first let's see what you have going already. Cheers.
Code every line like it might be your last...
Someday it will be.

Login to post a reply

Server time is: 2024-04-24 23:04:48
Your offset time is: 2024-04-24 23:04:48