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 / Help with pong

Author
Message
beginner98
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 28th Jun 2009 17:07
OK for my first BIG project (with the exception of tic tac toe) I'm making pong (with sprites) I was wondering if anyone had a idea on how I can make the ball move? bare in mind i'm using sprites and not 3D overhead view.

thanks.

c++ = easy GDK = IMPOSSIBLE lol
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jun 2009 21:15
Make two variables, velocity_x and velocity_y (floats) and each loop, add them to the sprites position.

beginner98
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 28th Jun 2009 23:15
moving it by velocity would make it move to fast though, anyway isnt the any way to move it with say some kind of timer?

c++ = easy GDK = IMPOSSIBLE lol
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 29th Jun 2009 05:21
That's why you learn simple math.

Don't make the velocity so high.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 29th Jun 2009 06:48
Also, multiply the velocity by like 0.95 each loop, for friction

Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 29th Jun 2009 06:51
What if the ball stops? D:
beginner98
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 29th Jun 2009 12:08 Edited at: 29th Jun 2009 14:26
ok I got it moving smooth and all but here is a new problem.

here is my code, see where the 2 while's are? when I add them the game dosent laod it just stops at a black screen.



c++ = easy GDK = IMPOSSIBLE lol
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 29th Jun 2009 16:26
As far as I can see this loop here

while (left)
{
dbMoveSprite(5,-0.95);
}


never ends.
beginner98
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location:
Posted: 29th Jun 2009 18:31
ok I changed the loops to

if(left = true)
{
dbMovesprite
}

that all works I need to work on diagonal movment and bouncing off walls so ....yah wish me luck with that! lol

c++ = easy GDK = IMPOSSIBLE lol

Login to post a reply

Server time is: 2024-10-01 05:54:44
Your offset time is: 2024-10-01 05:54:44