0 Favourites

working with angles of a sprite

  • 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...

    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...

  • s000.tinyupload.com/index.php

    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)

  • when the angle is 0...does that mean it is pointing straight up? and is this a 360 circle?

  • can you draw an example..? that would be awesome

  • 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 180�left, 270�upwards if that helps you.

  • 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..

  • 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.

  • when you draw the arrow like you did ? it will point up at 0�. When you create a sprite, it will be at 0�by 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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..

    dropbox.com/s/bqkd55td355z3li/squirrelnutsmeter01.capx

  • any ideas?

  • so I decided to disable most of the code for this event..and just left line 11 active...but still the sprite just moves to the right once, instead of every .05 sec rotating 10 degrees...not sure why it isnt constantly moving every.05 secs.

  • So I am at a lost here. I stripped down this even so I can try and figure out why the sprite is not rotating 10degrees every.05 seconds.

    The Arrow Rotates only one time upon the start of the game...but thats it..just once..any ideas??

    Also hey mind it took me a few days to figure out that there is a line with a circle at the end that comes out at the bottom(i guess where the pivot point is) and that represents the angle...anyway thanks

  • thought i did not solve my issue...i did create a new project...used that event on line 11, (post above this) and it seemed to work...

    sooo something is wrong with my event sheet to prevent my sprite from rotating every x second...

    i even create a new sprite ..used that event line and got nothing.

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