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 DBPro Corner / my first game- breakout

Author
Message
meteora12318
20
Years of Service
User Offline
Joined: 6th Jan 2004
Location: usa
Posted: 29th Jan 2004 05:14
Hey im trying to make a breakout type game but i cant figure out how to launch a ball from your paddle . i think i could figure out how to make it stop and bounce off the walls and blocks but i just need somethign to get it moving when you press the space bar. any help would be appreciated.

no signature in this
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jan 2004 05:59
If spacekey() = 1 then move_flag = 1

if move_flag = 1 then move object ball, speed

"eureka" - Archimedes
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 29th Jan 2004 16:38
or you could use variables to move your ball...

[Befor Loop]
XSpeed#=0
YSpeed#=0

[During Loop]
If Spacekey()=1 and Xspeed#=0 and YSpeed#=0
XSpeed#=rnd(5)-2.5
YSpeed#=rnd(3)+2
Endif

Position Object BallObj,Object Position X(BallObj)+XSpeed#,Object Position Y(BallObj)+YSpeed#,0

...and to make the ball bounce off objects just change the Xspeed# and YSpeed# or multiply them by -1 whenever they collide with the paddle, blocks, or walls...

well...I hope that helps...

Do not thwart the way of the dragon. For thou tasteth like chicken.
meteora12318
20
Years of Service
User Offline
Joined: 6th Jan 2004
Location: usa
Posted: 30th Jan 2004 01:54
thx Phaelax but the ball will only move when the space bar is held down. plus how would i make it change directioms?

no signature in this
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Jan 2004 04:18
The ball should only stop moving if you recent the move_flag somewhere. You'll have to find the angle of reflection. You would then rotate the ball to that angle, and continue moving.

"eureka" - Archimedes
meteora12318
20
Years of Service
User Offline
Joined: 6th Jan 2004
Location: usa
Posted: 31st Jan 2004 18:55
ok i think i got it working with

a = a + 1
move sprite 30, a
but i guess i do need help with it bouncing off the walls and maybe the blocks

no signature in this

Login to post a reply

Server time is: 2024-09-21 17:58:52
Your offset time is: 2024-09-21 17:58:52