Character Movement

forscienCeforscienCe Member Posts: 5
edited November -1 in Working with GS (Mac)
Ok so I will pay the person who help me with this if i have too. Noticed if stuff isnt very basic no-one helps out. Please I will return a favor in anyway you want.

Objective: I want my character to first have an animation where he flies then drops and you then have to push spacebar as soon as the animation is over and that makes you fly up. The character (Actor) has to continually fall on a screen height of 320px. If you let him fall to the bottom of the screen the actor hits the ground and then another animation goes in play that makes the character slide and then get destroyed. The game will have a power bar that indicates how much power you have left (power dissapears each time you press spacebar to make your actor fly up. The powerbar must slowly go back up when you not pressing spacebar. Now when you press spacebar your character must shoot up for a second and there must be a delay then it must drop again (this must use up some power). But if you hold spacebar in the character will shoot up till it hits the top of the screen and bouce down just a little bit.

Is this possible in GameSalad? (I have spent hours trying to get this right, and so far all i have gotten right is the continuously fly down motion, but it never stops. I also got a collide to work where it gets destroyed without the animation. (I couldn't get both to work together.))

If some1 could just tell me pieces and then other users can tell me how to do other things. I just need some sort of help or point in the right direction please :)

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Yeh you're pretty much asking for the whole game mechanic here. I'll see if i can help a bit;

    I would have an actor and call it floor.
    You'll need a game attribute (boolean) and call it dead for instance.

    On flying actor;

    1st i would create the following rule;

    If attribute game.dead is false
    Animate ... Your flying sequence
    have an accelerate down behaviour on him at whatever speed feels right. You may also want to go into the actor properties on the left and set a max speed.

    I would then have a rule that says;

    If actor touches/collides with actor floor
    Change game.dead to true

    New rule

    If game.dead is true
    animate .... Your death sequence here

    So what we are doing now is using the game.dead attribute to control things. If the actor is set to dead, you don't want him to carry on falling etc, at the same time you don't want him to carry on being able to fly up, we'll address this on the space bar rule

    New Rule

    All conditions (make sure this sing set to any)
    If keyboard space bar is pressed
    If game.dead is false

    Accelerate up at a greater speed than what you set him to fall at.

    Now, you may want to frame your working space with actors just out of shot, you can call these walls.

    Make sure your flying actor is set to collide with walls.

    You'll need to go into the walls actor and set it so that it is not moveable.
    Under the same properties section (if you don't know what I'm referring to look down the left hand side once your in the actor) look at its physics properties - if you don't want it to be bouncy when things collide, change the value to 0.

    Back in the flying actor;

    You want to make sure you have it set to collide with walls.
    Again you may want to look at the physics and change the flying actors restitution, 0 being no bounce at all. If you want it to hit the top and bounce a little try 0.2 and just adjust till it hits the desired level you're looking for.

    Right that should be enough food for thought to help you out a bit, it should have covered off the following;

    How to have the flying actor constantly dropping and animating the flying sequence.
    How to detect if the flying actor is dead and animate accordingly.
    Setting game attributes to help control and detect what is happening.
    Setting Space Bar to make the actor fly.
    Framing your working area with walls so the flying actor can't go off screen.
    How to change an actors properties, the physics, whether the actor is Moveable and setting Max Speed.

    Hoe that helps.

    Cheers
Sign In or Register to comment.