-
KoolMoves Moderator
Ok I've been working on it again. (thanks Kusco) It's somewhat playable now.
http://deadyeti.com/blanius/breakout.html
Souce file is there, It might be of interest to those wanting to start working in javascript.
-
Senior Member
-
KoolMoves Moderator
No I don't think I saw the angle thing, actually Dkerr mentioned I should consider that as well. As for adding to it any further I don't know that I'll put too much time into it. It was mainly an experiment to try out some ideas.
Never know though.
-
Senior Member
Originally posted by kusco
Did I end up sending you the version of your game where I made a change so that the ball would bounce off the paddle at a diffent angle depending on where the ball hit?
Kusco,
If you don't mind sharing, I'd like to see how you accomplished that.
-Jason
-
Senior Member
Originally posted by blanius
Ok I've been working on it again. (thanks Kusco) It's somewhat playable now.
http://deadyeti.com/blanius/breakout.html
Souce file is there, It might be of interest to those wanting to start working in javascript.
Bret,
the game is great. I'm gonna tear into the JS later(I can use all the help I can get in that area right now).
-Jason
-
Senior Member
But of course!!!
Hello Bret and Jason,
Here is the link to the modified movie from when I first received it.
http://www.syssoft.net.au/3dfa/breakout.movie
What I've done is to introduce a bit of javascript into it to get the ball to bounce off the paddle at a different angle depending on where the ball hit the paddle. If the ball hit the paddle closer to the edge then the angle would be greater.
I think I also added a few more levels of blocks but I can't be sure as it was a while ago since I did anything to this....or did I just do it differently????
The javascript code has a few comments line through it to help self-document the code and make it easier for debugging purposes.
If you have any q's about anything that I've done then please ask away as I'll only be too happy to help explain any of the 'things' I've done in here.
Bret, if you're not intending to do much more with it then what do you think about the idea of people making further changes to it and making it a community effort/collaboration? There's plenty of talent in this forum to make this more than just a game I personally would love to do more with it
Anyway, I'm babbling again so....
Cheers,
Ed
-
KoolMoves Moderator
Re: But of course!!!
Originally posted by kusco
Hello Bret and Jason,
Here is the link to the modified movie from when I first received it.
http://www.syssoft.net.au/3dfa/breakout.movie
What I've done is to introduce a bit of javascript into it to get the ball to bounce off the paddle at a different angle depending on where the ball hit the paddle. If the ball hit the paddle closer to the edge then the angle would be greater.
I think I also added a few more levels of blocks but I can't be sure as it was a while ago since I did anything to this....or did I just do it differently????
The javascript code has a few comments line through it to help self-document the code and make it easier for debugging purposes.
If you have any q's about anything that I've done then please ask away as I'll only be too happy to help explain any of the 'things' I've done in here.
Bret, if you're not intending to do much more with it then what do you think about the idea of people making further changes to it and making it a community effort/collaboration? There's plenty of talent in this forum to make this more than just a game I personally would love to do more with it
Anyway, I'm babbling again so....
Cheers,
Ed
I'll look at the code. I've made the source available and I hope people WILL play with it. Right now it has two levels and two rows of blocks. There is a bug in that the ball can get trapped below the paddle right now. I did use your hidden array to work around the invisible collision problem and that is working well.
-
KoolMoves Moderator
Re: Re: But of course!!!
Oh man Kusco you're making me look bad
You javascript is SO much more elegant. I may have to go back and work with YOUR code and abandon the kludge of code I've come up with.
You obviously have some programming background and it shows in your coding I encourage everyone to look at the javascript as an example of the right way to do it. It's thought out in advance and clearly laid out. Mine tends to be a bit of a mess as I figure it out as I go. I suppose this comes from teaching myself how to code....
-
Senior Member
-
KoolMoves Moderator
Perhaps we should just keep at each other eh? Maybe a little will rub off both ways... I'm looking very hard at the way you did the multible rows, I seems to me you used just one larger array where as I did a new array for each.
-
Senior Member
-
Senior Member
OK,
I am probably asking some real basic questions here, but please bear with me............
In the following line:
xVelocity = Ball.position.x - Paddle.position.x;
xVelocity = xVelocity;
Ball.velocity.x = xVelocity * 5;
Why do you state xVelocity = xVelocity, if you just set it in the previous line (wouldn't it already equal itself)?
Also this line is totally foriegn to me:
for(ndx = 0; ndx < MaxBlocks; ndx ++)
{
if(Blocks[ndx].collide(Ball) && Hidden[ndx] == false)
As near as I can tell its keeping the ball from colliding with hidden objects, but I can't figure out how. What does ndx represent here?
Again these are probably real basic questions, but I gotta learn sometime, and alot of this is Greek to me........................
Thanks in advance,
-Jason
-
Senior Member
Good Questions
Hi Jason,
The first question is fairly easy to answer. It's a left-over line of code that I was using when I was experimenting with the game. I simply forgot to take it out.
Now for the second answer.
ndx is a variable which is used to keep an iNDeX into the array. I use ndx as is sounds a bit like 'index' and is shorter.
The conditional statement checks for a collision on a block with the ball AND (&&) also if the block is not hidden. I use the array Hidden[] to keep track of which blocks have been removed from view. I probably should have used the is_showing() function (or the similar function - not at my 'real' computer right now) to check for this instead of using the Hidden[] array.
So the statement is saying something like "if the block is being hit by the ball and the block is not currently being hidden then..."
HTH
Cheers,
Ed
-
KoolMoves Moderator
Re: Good Questions
Originally posted by kusco
The conditional statement checks for a collision on a block with the ball AND (&&) also if the block is not hidden. I use the array Hidden[] to keep track of which blocks have been removed from view. I probably should have used the is_showing() function (or the similar function - not at my 'real' computer right now) to check for this instead of using the Hidden[] array.
Which is a work around for the fact that the ball kept triggering collision even with hidden objects.
-
Senior Member
Grey Matter
Hi Bret,
I completely forgot about the real reason for using the Hidden[] array.
Thanks! ...maybe I should cut back on the coffee...
Cheers,
Ed
-
KoolMoves Moderator
Broke it again
LOL
Well I started reworking Kusco's code and now I've got a wierd export problem.
When the ball dissaprears the whole movie shifts down about a third of it's height..... really odd.
Newest version
http://deadyeti.com/blanius/breakout.html
http://deadyeti.com/blanius/breakout.movie
I've determined it has something to do with the chooser element. Bug report sent to support!
[Edited by blanius on 05-09-2002 at 10:22 AM]
-
KoolMoves Moderator
Ok this version is getting good. Unlimited levels. Gets fast really quick..... Still can't get the chooser to work right so for now remaining balls is represented by number
Used javascript to keep ball in play now so that I could account for the width of the ball, using bounding action looked like ball particaly went off screen.
I will try to comment additional code better next few days.
-
Senior Member
-
Senior Member
Bret,
I also forgot to mention that the loading movie is showing a zillion decimal places for the percentage.
It looks like your trying to calculate PI
Cheers,
Ed
-
KoolMoves Moderator
LOL
Originally posted by kusco
Bret,
I also forgot to mention that the loading movie is showing a zillion decimal places for the percentage.
It looks like your trying to calculate PI
Cheers,
Ed
I never really see it goes by so fast now that I have DSL
Just need to round it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|