Sprites rotate instantly

0 favourites
  • 7 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi, I have a problem where when I tell something to rotate toward angle instead of rotating it will just snap to the angle instantly. What am i doing wrong? thanks for any help people.

  • How are you using the action? On keypress, touch, etc.

    The degree is how much it moves each time that Event is triggered. For example if:

    One KeyDown Z

    ------->rotate 1 degree towards 270

    This means, while I hold down the Z key the object will rotate 1 degree per tick towards 270.

  • I have it like this:

    Condition: Sprite -> Land=2

    Action: Sprite -> Rotate Clockwise: Anglediff(270, Fighter.Angle).

    Also I tried:

    Condition: Sprite -> Land=2

    Action: Sprite -> Rotate Toward angle: Anglediff(270, Fighter.Angle) degrees toward (270)

    Condition: Sprite -> Land=2

    Action: Sprite -> Rotate toward angle: (1) degree toward (270)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, that bottom one should work. Do you have a sample capx?

  • I'm having a similar problem. I've tried tackling it several ways and seem kind of stuck.

    Ideally, I want a limited-rotating turret to slowly move towards either 20-degrees left or right as long as either left or right arrow are held down.

    My first attempt:

    Turret.Angle = 270

    On Left Arrow is down, Rotate Turret 5 degrees toward 250

    On Right Arrow is down, Rotate Turret 5 degrees toward 290

    In practice, what happens is as long as I hold left, the turret snaps to 265 (270-5) and stays there... so basically it's only updating that condition one tick when Left is pressed, rather than constantly while it's held down.

    ... I tried tackling it this way:

    Turret.Vector = 0

    Turret Angle = 270+Vector

    On Left Arrow down, set Vector = -20

    On Right Arrow down, set Vector = 20

    Every Tick, rotate Turret 10 degrees toward Turret Angle (270+Vector)

    Still no dice, it's rotating 10 degrees either direction only, so it's still updating only once. I just started using Construct 2 this week, so maybe there's something I'm missing about how to get this to update every tick?

  • Wait. I found my problem.

    Earlier on in the sheet when I spawned the turret item, I think I set its angle to 270 effectively locking it in place. Will check.

    *edit* Yes, this was my problem. Changed the spawning logic to work once, instead of every tick fixed this.

  • Hi, I have a problem where when I tell something to rotate toward angle instead of rotating it will just snap to the angle instantly. What am i doing wrong? thanks for any help people.

    Did you multiply the angle in the degrees field with dt(deltatime)?

    This should make a smooth rotation measured in degrees per second.

    It looks something like so:

    Sprite->Rotate 180*dt degrees toward OtherSprite.Angle

    HF

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