A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Please help me with action script of bouncing.

  1. #1
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462

    Please help me with action script of bouncing.

    hey i need help with a action script that allows a ball to bounce infianly on a bottom mc altomatically with gavity and it needs to be a diffrend kinda action script i used for my alto bouncing platform game i posted a few days ago so like the ball bounces 1little bounce then 1 big 1 like that this is very hard 2 do iv tryed 2 find a acript diffrent to the 1 i already have all day because the same script wont work 2 times in 1 movie thats why i need a diffrent kinda script as well. have a look at my platform game to see the kind of script i already have.

  2. #2

  3. #3
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    I already know how to do that look at my platform game posted on this site to see what im on about it must be a ball bouncing at the same hight for a infine time(for ever) just like the 1 in my platform game but i need a diffrent action script for it with hittest.ground.

  4. #4
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Quote Originally Posted by XareoX
    I already know how to do that look at my platform game posted on this site to see what im on about it must be a ball bouncing at the same hight for a infine time(for ever) just like the 1 in my platform game but i need a diffrent action script for it with hittest.ground.
    All you have to do is to modify that actionscript according to your needs ...
    Anyway, just set this script for that ball:
    Code:
    onClipEvent (load){
        gravity = 10;
        tim = getTimer();
        tim = tim / 100;
        dow = _parent.box._y + _parent.box._height - (this._height/2);
        bounce = 1;
        speedystart = 25;
        maxspeed = 90;
    }
    
    onClipEvent (enterFrame){
        timenow = getTimer();
        timenow = timenow / 100;
        speedy = gravity * (timenow - tim) + speedystart;
        this._x = this._x + speedx / 5;
        this._y = this._y + speedy / 5;
        if (this._y > dow){
            this._y = dow;
            speedy = speedy * -bounce;
            tim = getTimer();
            tim = tim / 100;
            speedystart = -maxspeed;
        }
    }

  5. #5
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    in another way what is the script u made to make dizzy jump because i forgot the action script i found another 1 the jumping is fine but when i roll of the ground mc i dont fall of the stage. And that script above dident work with my other script.

  6. #6
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    see here is the script i used to make an object jump but add it to a mc named char then add a ground mc and u will see it jumps fine but it doesnt drop of stage if you roll of ground here is the script
    Last edited by XareoX; 08-12-2006 at 04:51 AM.

  7. #7
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Quote Originally Posted by XareoX
    in another way what is the script u made to make dizzy jump because i forgot the action script i found another 1 the jumping is fine but when i roll of the ground mc i dont fall of the stage. And that script above dident work with my other script.
    As I said many-many-many times before, flash environment, because of its poor global performances, is not suitable for sophisticated projects ("real games" for example).
    In other words, you have to optimize each piece of AS to get a decent frame rate. And even so is not enough ...
    The upcoming AS3 seems to be 5-10 times faster, but we have to wait a little bit.

    Now coming back to your "bouncing ball", you should use that script because is the best approach.
    Just change (tune up) the "dow condition" (the hitTest emulation).
    That's your floor Y position.
    I think it's simple enough ...

    cheers

  8. #8
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    ok

  9. #9
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    I found another way but thanks u still helped me a little bit any way cheers

  10. #10
    Banned XareoX's Avatar
    Join Date
    Aug 2006
    Posts
    462
    Hahaha iv done it i made it so he can jump when up arrow is pressed and he can fall
    if he goes of platform i just edited a lot of the code i used from another game.

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