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.

Dark GDK / Movement Error

Author
Message
mikeMarek 597
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 15th Apr 2009 05:17
I have a small issue with an Asteroids clone I'm making. I move the asteroids across the screen with the following code:


Where ast_x[i] and ast_y[i] are the coordinates of the asteroids and ast_direction[i] is the movement angle (90 = right, 0 = up, etc). Also, if you can't tell, the asteroids are in arrays

So, my problem is that when the asteroid reaches a screen boundry, the asteroid just rides along the boundry, and doesn't follow it's defined rotational path. I have no code that does this. Is it because Dark GDK has issues calculating stuff outside of the screen boundries? Or is it something else I should debug myself?

-Mike
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 16th Apr 2009 13:39 Edited at: 16th Apr 2009 13:43
Do you mean that it keeps going past the screen where you cant see it? Theres a simple way to fix this, just put an



Hope this helps
mikeMarek 597
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 17th Apr 2009 01:14
No, the asteroid would just randomly shift into a different direction when it went offscreen. I managed to fix it up today though, turns our I needed to make the asteroid's coordinates into a float instead of int, as it was not as precise.
tomtetlaw
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location:
Posted: 17th Apr 2009 09:27
Cool nice work.

Login to post a reply

Server time is: 2024-11-25 14:56:01
Your offset time is: 2024-11-25 14:56:01