Make a Sprite Change 90 Degree Direction

Get help using Construct 2

Post » Sun Sep 06, 2015 10:15 pm

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?
B
223
S
124
G
8
Posts: 144
Reputation: 22,139

Post » Mon Sep 07, 2015 5:51 am

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...
B
7
S
2
Posts: 92
Reputation: 663

Post » Mon Sep 07, 2015 4:02 pm

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.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Mon Sep 07, 2015 9:39 pm

Ah yes, I forgot about the Object.Angle usage. This did work. Thanks to you both.
B
223
S
124
G
8
Posts: 144
Reputation: 22,139


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 56 guests