A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 30 of 30

Thread: the breakout game

  1. #21
    Member
    Join Date
    Feb 2002
    Posts
    71

    Re: Lookin' Good!

    Originally posted by kusco

    Instead of using a chooser element to show how many balls you have left, how about cloning it?
    I've been "eavesdropping" here. Things have been so busy that my 3dfa javascript tutorializing (is that a word?) has been on hold - but your statement reminds me that I was working on a project that involved showing and removing squares (sort of minesweeper-like) - I used cloning in the previewer and the idea worked great. As soon as I exported to the browser (IE5.5) however, the clones disapeared. Can we get clones to appear and disappear in the browser?

    thanks!

    Jon

  2. #22
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: Re: Lookin' Good!

    Originally posted by JDE
    Originally posted by kusco

    Instead of using a chooser element to show how many balls you have left, how about cloning it?
    I've been "eavesdropping" here. Things have been so busy that my 3dfa javascript tutorializing (is that a word?) has been on hold - but your statement reminds me that I was working on a project that involved showing and removing squares (sort of minesweeper-like) - I used cloning in the previewer and the idea worked great. As soon as I exported to the browser (IE5.5) however, the clones disapeared. Can we get clones to appear and disappear in the browser?

    thanks!

    Jon
    elementname.show()
    elementname.hide()

  3. #23
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    Hi JDE,

    In addition to Bret's response cloned elements do not work correctly in child movies. So if you have these elements in a child movie I would suggest (at least until vers. 3.6 becomes available) to put all of the elements you wish to clone in the main movie.

    As to whether the word 'Tutorializing' is a word - I don't know but if it isn't let's put it in the dictionary .

    Cheers,
    Ed

  4. #24
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681

    As promised

    Hi,

    I've dabbled with this beast a little more

    Bret, I really hope you don't mind? It's a great project to learn from.

    Anyway, here is the link to the modifications I've made.
    http://www.syssoft.net.au/3dfa/breakout2.movie

    I've renamed this version so as not get it mixed up with the previous one/s just in case.

    What I have done in this example is the following...[list=1][*] Modified just about all of the action scripts containing a javascript element with various stuffs (most listed below).[*] Removed any occurances of varname++ and replaced it with varname = varname + 1. This was done to prevent the possibility of memory leaks. (varname is the name of any variable using the ++ operator)[*] Resized the ball slightly (more of an accident than anything else).[*] No longer using the velocity.x/y for the ball. Instead, I'm using an action script running 60 times per second to move the ball around. This makes the ball move around the screen a bit smoother and faster. I did this because the maximum frame rate is 30 but action script elements can run up to 60 (so I've discovered) which makes movement smoother. Otherwise the ball appears to move in a more jagged fashion.[*] Changed the frame rate from 16 to 30 to smooth things out a little more.[*] Changed the other action script elements to run at 60 time per second.[*] Reworked the bounds checking for the screen. I found that in using either the original bounds checking or this version the ball would sometimes get stuck on the left or right edges.[*] Reworked the bounds checking for the ball colliding with the blocks. Now the ball will bounce off the sides of the blocks making it ricochet a little nicer.[*] Reworked the angle variance for when the ball hits the paddle.[/line=1]
    Anyway, have fun. I know I have in both playing it and working on it

    Bret, again - hope you don't mind. But .... this game you've come up with should be posted somewhere! It's fun!!!

    Cheers,
    Ed

  5. #25
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: As promised

    Originally posted by kusco
    Anyway, have fun. I know I have in both playing it and working on it

    Bret, again - hope you don't mind. But .... this game you've come up with should be posted somewhere! It's fun!!!

    Cheers,
    Ed
    I swear I'm gonna smack you if you apologise again....
    I've learned so much from this. Anyway I've posted the newest version at
    http://deadyeti.com/blanius/breakout.html

    Near future I'm going to do some sort of high score thing and I've added a couple of menus, Ed what link would you like to you in the credit page?

    Very Nicely done.


  6. #26
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681

    LOL

    Ok, ok, I'm sorry

    Anyway, I couldn't help myself, I've done it again.

    Anyone using the keyboard to start something in a movie (as in this game) may be interested in the accompanying html document.

    What I've done is to set the focus on the movie when the page has loaded or when the web browser gains focus. This means that the user doesn't need to click somewhere on the movie first before keyboard keys can be used. It's all documented in the html document and may prove useful.

    Dkerr (if your watching) I would like to suggest putting this code as an option in 3DFA (as in a checkbox) so that developers can set the focus of the movie by default or not. In essence 3DFA could produce two versions of the html code. One being what is generated now and the other that includes the "auto-focus".

    I use IE5.something so anyone that has Navigator, could you test the focus method and let us all know if it does or doesn't work - thanks.

    Now back to the game:
    Bret, I noticed that there's a bit of text in the webpage (for the game) that states that the movie has to be reloaded in order to begin a new game. Not anymore, I've added a new action script element that resets all the variables of the game, modified the show/hide element for the New Game button and it seems to work fine.

    Again I've renamed the movie. I do this as a means to protect your original incase what I've done doesn't work properly.

    Here's the link...
    http://www.syssoft.net.au/3dfa/breakout3.zip

    Bret, as for a link to my site, thanks. As soon as I have a page ready (I'm working on one) I'll give you the link.

    ...now for some breakfast

    Cheers,
    Ed

  7. #27
    Senior Member
    Join Date
    Jan 2002
    Posts
    118
    Great job guys. Bret, what kind of server does your site run? Maybe I could create a cool high-score system for it. Anyway, thanks to you, I'm creating my own snake clone. Thanks for the great javascript!

  8. #28
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by ajcompany
    Great job guys. Bret, what kind of server does your site run? Maybe I could create a cool high-score system for it. Anyway, thanks to you, I'm creating my own snake clone. Thanks for the great javascript!
    Cool can't wait to see it. The praise for the javascripting should mostly go to Kusco, he's brilliant at this. I've gleened alot from him already.... I haven't even put in everything he's contributed yet, still looking it over. As for the high scores, I have full hosting with mysql and php so it won't be hard to add just have to get around to it.


  9. #29
    Senior Member
    Join Date
    Jan 2002
    Posts
    118
    ok, thanks kusco! on the high score note, PHP eh? I'll see If I can get something up for mysql and that. I haven't done much PHP recently, but I'd like to try.

  10. #30
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    'tis a pleasure to help out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center