Limit rotation

0 favourites
  • 7 posts
From the Asset Store
An example of how to make old style RPG random encounters and a limited battle system.
  • Hey, I have a cannon like object with "set angle toward (mouse.x,mouse.y)

    on every tick. (thats the entire capx)

    I need this cannon to stop rotating and remain fixed if the mouse causes the angle to be above say 260 or below 45.

    Also it will need need to work when the cannon faces the other direction.

    I just dont want it to shoot more or less strait up and down

    Thanks and I'm new<img src="smileys/smiley3.gif" border="0" align="middle" />

    P.s. I tried turret range behavior but that is for detecting targets

  • Well, I thought of a way but its really stupid make the cannon invisible when it reaches a certain angle and then spawn a static one in its place, but its lame I was hoping 2 do it the math way

  • +Every Tick

    -> set angle toward

    -> if angle > max angle

    --> set angle to max angle

    -> if angle < lowest angle

    --> set angle to lowest angle

    you could also set the if to the every tick(this would save unecesarry..) but when you will be every time a bit above or under your max.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok. im trying that now

  • Im having trouble with this part:

    -> if angle > max angle

    Is this a 2nd condition after: -> set angle toward mouse x/y

    Do i need a variable to get the angle of the cannon?

    I cant find a condition that just retrieves the current angle?

  • Nah,

    Add condition -> system

    + Compare Two Values

    First value = max angle

    Comparison = <

    Second Value = yourObject.angle

    Thats it, nothing more. .angle = get the current angle of an object

  • Hey, I have a cannon like object with "set angle toward (mouse.x,mouse.y)

    on every tick. (thats the entire capx)

    I need this cannon to stop rotating and remain fixed if the mouse causes the angle to be above say 260 or below 45.

    Also it will need need to work when the cannon faces the other direction.

    I just dont want it to shoot more or less strait up and down

    Thanks and I'm new

    P.s. I tried turret range behavior but that is for detecting targetsfarnsu2013-05-11 18:58:48

    hi farnsu did you manage to fix this i been trying to do the same for more than two weeks, is it posible you share a capx if you fixed it thanks a lot

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