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 / Pong Al help

Author
Message
Oster200
13
Years of Service
User Offline
Joined: 21st Jan 2011
Location:
Posted: 11th Jul 2011 04:43 Edited at: 11th Jul 2011 06:39
I am creating a pong game and i want the other paddle to move by it self Why isnt this code working

okay so the ball bounces off the paddle and the player is trying to get points by making the other player miss. i got every thing running fine i just want the other paddle to move by the computer and btw it can on move verically(up and down) so i was wondering y the paddle isnt moving by it self
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 11th Jul 2011 04:51
Hi, could you please provide a little more info on what doesn't work like does it compile and run? What does the paddle do instead of moving as you intend it to?

Oster200
13
Years of Service
User Offline
Joined: 21st Jan 2011
Location:
Posted: 11th Jul 2011 23:20
Well i got it some what working i got it so it goes after the ball except if there is no ball or if it is at the same hight as the ball it just wants to move up can some one help me so that if there is no ball or it is at the same hight it dosent work.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 12th Jul 2011 01:40 Edited at: 12th Jul 2011 01:40
Ok, I have a clearer picture now. The first thing I would like to suggest is to move the paddle via a y value instead of the dbMoveSprite command. So it would be like:


Then later draw the sprite like this


As for not moving the paddle when the ball isn't in the screen you could have a boolean ball_in_screen and add that to your if statements.

Login to post a reply

Server time is: 2024-11-19 09:31:42
Your offset time is: 2024-11-19 09:31:42