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.

2D All the way! / Need help with my Break Out code.

Author
Message
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 26th Jun 2004 05:36
I have a problem that when all the blocks on level 1 are destroyed, and the second level is started the Balls position is left off where the ball left off from lv 1. This is terrible because when lv 2 appears like 5 blocks are destroyed automatically because of the balls position. I know this sounds extremely easy to fix but I have tried everything that I could think of that would fix this.

Here is the download link to my full game with all the media.
http://www.angelfire.com/games5/db_games/BlockOut.zip

the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 26th Jun 2004 11:45 Edited at: 26th Jun 2004 11:51
I think line 131 is where you make a new level. There you have
if new_lv = 26
pos_ball = 1
sprite 2, ball_x,ball_y,2

I think all you will need to do is change ball_x and ball_y so it looks like this,
if new_lv = 26
pos_ball = 1
ball_x = 320
ball_y = 330
sprite 2, ball_x,ball_y,2

you might want to center the player as well just add,
player_x = 320
player_y = 340

---

Also when positioning a lot of sprites you can make your life easier by looking for ways to position them with loops and maths. Something like this.



can i scream
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 26th Jun 2004 20:31
doesnt work and thats what pos_ball is for . Ty anyway
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 26th Jun 2004 21:31
This seems to turn off your ball positioning ......

pos_ball = 0

It's in the middle of your routine.

Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 27th Jun 2004 02:41
If I dont turn it off then the loop keeps the ball at 320x and 320y position. Thus the ball keeps glitching to move but is sent back to 320x and 320 y position.
ToXic
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Australia
Posted: 27th Jun 2004 03:07 Edited at: 27th Jun 2004 03:27
I had a play with your code, hope you don't mind.
Sprites are not really the way to go when using DBC, when you finish
your game try and convert it to 3D using plains for a big speed increase.



ToXic.
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 27th Jun 2004 08:19 Edited at: 14th Jul 2004 08:08
Wow Thanks ...
lol turned my hunk of junk code into a much nicer piece of work.
I had to tweak the ball speed and player speed because it runs so much smoother now.
ToXic
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Australia
Posted: 27th Jun 2004 09:31
Glad I could help.

ToXic.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 2nd Jul 2004 04:54
I might be a little late in posting here but in my breakout game I did it the easy way;

if all blocks are gone when the ball strikes the paddle, it redraws level two on the screen. Problem solved before it begins!

S.

Any truly great code should be indisguishable from magic.
Skeletor
20
Years of Service
User Offline
Joined: 21st Jun 2004
Location: florida
Posted: 2nd Jul 2004 15:21
ooohhhhh that sounds like a very easy way. Thanks Ill have to try that out.

Login to post a reply

Server time is: 2025-05-17 09:52:35
Your offset time is: 2025-05-17 09:52:35