How do I animate 360

0 favourites
  • 7 posts
From the Asset Store
Video intro templates for games and game making with Construct 3 made with Animate
  • hello all.

    i have a game that uses 3D to 2D images, and now i have a question. how do i animate 360 rotating?

    here's an image of what i got:

    i.imgur.com/XCuhGyF.png

    now, that boat has one animation and that animation is every corner od 360°. Animation is disabled by default and current frame is set to 270 (of 360), so the boat is facing up. now when i press "a" or "d" i want the boat to rotate - > changing frames, not playing animation, while i hold the key.

    is there any way to do this easier? possibly without 360 frame animation? i could cut down to 96 frames 4x24 for each quadrant, but still a lot of work to do. i also would have to set on each frame a "firing point" and more...

  • You need to add a "Keyboard" plugin on your project.

    Use the event "On key down" "d" and add the action "Boat: Set animation frame to (Boat.AnimationFrame + 1) % Boat.AnimationFrameCount" where Boat is the sprite that contains your boat animation.

    Use the event "On key down" "a" and add the action "Boat: Set animation frame to Boat.AnimationFrame - 1" and add a subevent "Boat: Animation Frame <0" action "Boat: Set animation frame to Boat.AnimationFrameCount - 1".

    This should do what you intend to. At worst, post/attach a current capx to your post to let us help you further.

    Be aware international keyboard user won't appreciate the use of the "a" key.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Doing it your way would be something like:

    give the boat an instance variable: angleframe

    a key is down : set boat.angleframe to boat.angleframe-1

    d key is down : set boat.angleframe to boat.angleframe+1

    system compare two values: boat.angleframe=360 - set boat.angleframe : 0

    system compare two values: boat.angleframe=-1 - set boat.angleframe : 359

    every tick - boat set frame to: boat.angleframe

    Btw instead of making the firing point on every frame why not make an invisible sprite with the imagepoints in the right place and rotate it to the angle of the boat.animationframe?

    It would actually be far wiser to rotate your boatsprite itself instead of having animation for each angle..

    You could have a few frames to give the impression of 3D but this seems like overkill..

  • Kyatric - i will try that. i used to do it with instance variable like littleStain said it, but it seemed overly complex for that. about the keyboard - i know that i need that object, and i've created a "main menu", where you can bind keys as you like

    LittleStain - i think i will use kyatric's method for that. but i have a question for shooting. i mean, firing point. why do you think i should use another inivisible sprite? couldn't i use imagepoints on the same boat sprite, and rotate it with boat? though i have tried something like that before, but i think that point doesn't move as boat does. example: default like on image - if i put on top of the boat iamgepoint, it will fire from it's nose, if i rotate.. let's say 45° left, it will fire from under the ship, because point moves wierd and boat gets longer from rotating.

    also, if i rotate 1 sprite without animation, it looks wierd, like upside down boat: here you go:

    i.imgur.com/EmKWZ4a.png

  • Yes you could set an imagepoint for each animationframe, which would mean setting it 360 times, or set it once on an invisible sprite..

    The effect would be basically the same (as in noone would notice) and it woulf be a lot less work..

  • but why on an invisible sprite? i can use boats sprite, no?

  • Just do it your way 360 times, instead of 1..

    Good luck..

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