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.

2D All the way! / Create Multiple.... (Dark GDK)

Years of Service
User Offline
Joined: 15th Sep 2009
Posted: 16th Sep 2009 03:01
Hi everyone

I'm new here and in Programming

To go right to the subject I am trying to make a game where you have to escape asteroids.

Now using Dark GDK I now have a functional Spaceship and asteroids sprites, and have almost a collision detection system for the sprites.

The asteroides are part of the Structure Asteroid, wich contain a posx and posy, a radius, speed and angle.

Then the asteroid Sprite is set to go down wich works.
So the asteroid goes down but theres only one. I'd like to have many, like 20, but I can't figure how to make multiple Asteroids appear. So I tought of making an array, but at that point, its beginning to be out of range.

If anybody has an idea... make it worthy
feiting shadow
Years of Service
User Offline
Joined: 12th Sep 2006
Posted: 17th Sep 2009 10:44
Nothing real can be threatened
Nothing unreal exists.
Herein lies peace.

Everyone wants to ask how to obtain enlightenment. "What should I do?" They attend satsang and get nowhere, but if the local ashram didn't provide a satsang, they wouldn't have any money. The truth is simple, just be Quiet. No thought. When you grab that rope of understanding a light will emanate throughout your being and you will obtain bliss.

Is that worthy.

Bibliography: Sri H. W. L. Poonja and Helen Shucman

Years of Service
User Offline
Joined: 25th Sep 2009
Posted: 2nd Oct 2009 09:30
ok... i don't know what the heck feiting shadow is on but me want in alrighty as to your question why not use the code that is generated the first time u click on new dark gdk game, if u don't have it here it is lol u'll find the picture/sprite (sprite.png) in C:\Program Files\The Game Creators\Dark GDK\Wizards\Projects\Dark GDK - 2D Game\Dark GDK - 2D Game\Templates\1033 and the project should be somwhere there as well. hope this helps and here is the code for the asteroids
this generates random asteroids that spin as they fall from the sky. now my turn to ask a question lol could u please show me your collision detection system lol i am making a game almost exactly the same as yours (well almost)
Serial Velocity
Years of Service
User Offline
Joined: 24th Aug 2008
Posted: 2nd Oct 2009 17:40 Edited at: 2nd Oct 2009 17:44
Perhaps you can structure your class/struct like this:

What I've done is insert a Render() function, which you call once a loop to render that sprite to the screen. Then you create an array of 20 asteroid objects:

Then in your main loop, loop through this array, calling Render() for every member.

Login to post a reply

Server time is: 2023-01-29 06:14:58
Your offset time is: 2023-01-29 06:14:58