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 / Bullet Trajectory Problem

Author
Message
hackinc 2000
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: Puerto Rico
Posted: 15th Apr 2015 15:39
Lets see, as more I want to understand this I can't make it right. In the following code I made a sprite move from point A to Point B, but what I want its to Move it infinite to the direction of Point B. Yep, bullet trajectory... I don't know Why I can't get it!!!

When It reach point B it stops moving. And I can't figure how to make it continue. Any help that help me understand this would be appreciated.

Thanks in advance.

Here's the complete code:



Mike Archer
9
Years of Service
User Offline
Joined: 19th Feb 2015
Location: Wales
Posted: 15th Apr 2015 16:37
It stops because you are recalculating the movement direction every single loop, you should calculate it once at the time space is pressed.
hackinc 2000
19
Years of Service
User Offline
Joined: 2nd Dec 2004
Location: Puerto Rico
Posted: 15th Apr 2015 19:14
Thanks Mike!!

I move the direction calculation when I press space, and actually the sprite don't stop this time. Thanks for that. But now the sprite don't follow the direction and just go downwards.

Login to post a reply

Server time is: 2024-11-24 00:16:10
Your offset time is: 2024-11-24 00:16:10