GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I.....

QuantumGames94QuantumGames94 Posts: 13Member
edited May 2012 in Working with GS (PC)
Hi I have made a set up for an app where the ball hits one of the walls and then the ball resets itself to the start position and then you have to press the play button again for it to start playing again but the paddle that the ball bounces off does not go back to the start position when the ball does how do I get the paddle to move back into its start position when the ball hits that wall???

Best Answer

Answers

  • QuantumGames94QuantumGames94 Posts: 13Member
    I have only been using for 1 day how do I reset the paddles rotation and do I need to add any attributes to it to do it???
  • tatiangtatiang Posts: 11,791Member, Sous Chef, PRO, Senior Sous-Chef
    Generally, if you want to reset an actor's attribute, you do the following:

    1. Create an attribute self.someName
    2. Add a Change Attribute behavior at the top of the actor's rules to keep track of the initial value of an attribute
    3. Based on a rule (When something changes), do a Change Attribute to change the attribute to self.someName

    So, if you want to reset rotation, you would have:

    1. An attribute (angle type) called self.InitialRotation on the paddle actor.
    2. A behavior in the paddle actor to Change Attribute self.InitialRotation to self.rotation
    3. A rule in the ball actor that says When actor overlaps or collides with actor wall --> Change Attribute game.HitWall (boolean) to true; Timer after 0.1 seconds --> Change Attribute game.HitWall to false. A rule in the paddle actor that says When attribute game.hitWall is true --> Change Attribute self.rotation to self.InitialRotation.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

This discussion has been closed.