# setting animation frame to specific angle

For questions about using Classic.

### » Sun Mar 04, 2012 10:36 pm

hi guys.

my racing game is coming along pretty nicely, i have the base gameplay so that i can adjust stuff easily, and im overall pleased. BUT (yeah you knew it was coming lol)

i started thinking about artistic stuff and presentation. started toying with the idea of trying to make the perspective isometric. i could very well use the existing handling that ive made using the physics object(the actual car sprite is just set on the physics object every tick/always), but the car sprite's presentation would need some work,if its not top down view,but isometric.

so i ask you wise people, is it possible to to set animation frame to a specific angle?

for example, if i was to use 360 frames (oh god i really wouldnt, dont be alarmed) for my car's angles, how would it be done? meaning frame 0 is angle 0 and frame 359 is angle 359. i wouldnt want to make actions for every separate angle even if i used less frames, im sure theres simpler, easier way, eh?

am i too far off if i guess its somehow done by clamping? though i dont really know the correct action or event for it
B
1
S
1
Posts: 12
Reputation: 399

### » Mon Mar 05, 2012 4:03 am

In your example, if you'd like to set the frame according to the sprite's angle, it's just

+ Always
-> Sprite Set animation frame to round(.Angle)

If you have less animation frames, let's say 18 (describing a complete circle), it would be

+ Always
-> Sprite Set animation frame to round(.Angle / 20)

because 20*18 = 360
So basically you'd just divide 360 by the number of frames to get the factor by which you need to divide the actual angle.

f = 360 / numberofframes
actual framenumber = actual angle / ftulamide2012-03-05 04:04:16
B
24
S
8
G
10
Posts: 1,822
Reputation: 8,291

### » Mon Mar 05, 2012 11:58 am

thanks tulamide! i knew there was a simple way to do this, even i can understand that piece of code lol!.

i'll try this when i get home, BUT (yeah yeah..)

once again i started wondering if:

there was a way to cut the amount of frames in half, so i could use more frames without sacrificing VRAM that much. because, correct me if im wrong, theres the option to mirror the sprite angle when moving the opposite direction..? so, if i had a frameset consisting of angles between 270 and 90 going clockwise, in other words a half circle of frames, i could somehow mirror the car sprite, thus drastically saving VRAM and i could make more frames and get smoother rotation.. but that would need some extra eventing and/or math, no?
B
1
S
1
Posts: 12
Reputation: 399

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 1 guest