working with angles of a sprite

Get help using Construct 2

Post » Tue Nov 05, 2013 5:02 am



so I made a struggle meter that shows up when the player collides with the bird.....you press either left or right to get it to move left...
every half sec it will move right....


now the issue is, when the struggleArrow Sprite is pointing all the way right I want it to take a subtract a point from the health variable...


some reason I cannot figure out the angle...



http://www.dwbailey.com/images/StruggleMeter/

link to play...just run into the bird to see the meter...press left and right to affect it..


also on the left and right...it would be nice to have to press them in sequence...right now i can keep on pressing left and it will go 10 degrees counterclockwise...it would be great to have to press left and then right...left..right..left..right...and so on...
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 3:10 pm

http://s000.tinyupload.com/index.php?file_id=95473769236856671957

just know this: when the angle is 0 and you substract 10, the angle becomes 350 in construct. This is important to know if you are using system compare expressions like "sprite.angle = 270" (-90 doesn't work)
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Tue Nov 05, 2013 5:57 pm

when the angle is 0...does that mean it is pointing straight up? and is this a 360 circle?
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 5:58 pm

can you draw an example..? that would be awesome
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 6:16 pm

You can view the angle of any sprite by selecting it in the layout.

If a bullet has the angle 0, it will fly right, at 90 down, at 180left, 270upwards if that helps you.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Tue Nov 05, 2013 8:04 pm



so is this correct then...

also can you explain the thinking with the instance variables...active and leftright...how did you get it the left right to work back and forth like that....thanks for the help...i just like understanding whats going on...to further help me down the road..
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 8:23 pm


snake850272013-11-05 20:24:04
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 8:30 pm

I have a question on this set up...on the first events where its between 269 and 81.... why isnt it 181 and 359...? i guess i get confused by the sprite graphic...i see my arrow graphic pointing straight up thinking thats that degree is aiming at 270 so just rotate according to that...

but is it more like a imaginary arrow...lets say you have the angle at 0 for your sprite in the layout..a imaginary arrow will be pointing Right...and it has nothing to do with your graphic that may be pointing in whatever direction...?

in this example we have are arrow pointing up at the start....shouldnt we have the angle point be 270 in the layout of the sprite...to represent that current angle to match the graphic??   

just trying to figure this all out..probably thinking to much as usual.snake850272013-11-05 20:31:14
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Tue Nov 05, 2013 10:41 pm

when you draw the arrow like you did ? it will point up at 0. When you create a sprite, it will be at 0by default. So if you would paint the arrow like this -> your assumption between 180 and 360 would be correct as the arrow would be aligned to the angle.

The thinking for the left-right is simple. Think about it like a switch. If the switch is left (leftright = 0), you can only push it from left to right. This transfers the switch to a right position (= 1) where you can only push it from right to left.

Active is similar, it switches (off) when a specific condition is reached, in this case the desired angle.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Thu Nov 21, 2013 5:13 pm

Hey mind some reason I can not get it to work...I have it to when the squirrel collides with the bird..the Meter image comes up...some reason the Meter Arrow Graphic does not move on its own...also the arrow graphic only moves when I press left..

https://www.dropbox.com/s/bqkd55td355z3li/squirrelnutsmeter01.capx
B
9
S
2
Posts: 272
Reputation: 1,632

Next

Return to How do I....?

Who is online

Users browsing this forum: DharmaOne and 23 guests