Make a Sprite Change 90 Degree Direction

  • I'm working on a prototype for my game involving a square collecting stars in a stage that has a goal. Every time the player Mouse clicks/Keyboard taps, the square goes in another 90 angle direction (from EAST to SOUTH to WEST to NORTH to EAST...). When the square collides with a wall, the square goes backwards in a 180 angle direction.

    I've been able to get the Wall collision working properly but the 90 angle direction change for every Mouse click/Keyboard tap isn't working. What is required in the Event List to have the square turn 90 degrees with every click/tap?

  • Is it a regular square? 90 degrees wont show an effect, because a square will always be on its side.. but... if not, you do this...

    every click, or clicked on object, set angle to Sprite.Angle + 90

    Objects return data members through dot notation. If you type your sprite name and period, you'll see what can be returned... current angle, current x,y, some other stuff...

  • All sprites have an "Angle" parameter that you can either set manually or via event. Just do like:

    Sprite: Set angle: Sprite.angle + 90

    Like JeremyBenson11 says.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah yes, I forgot about the Object.Angle usage. This did work. Thanks to you both.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)