Sprite Orienation on movement

For questions about using Classic.

Post » Sun Apr 25, 2010 3:23 am

I've not searched the forums before posting this as I'm not sure what to put in a search, so apologies if this has been covered elsewhere.

I've started a new project and inserted some sprites. The sprites display on the layer correctly, right orientation, but when movement is applied to them, one with a 8 Direction Behavior and the other with an Event to Angle toward the Mouse - both setup directly from the Ghost Shooter Tutorial, each moves to end up at 90 degrees wrong angle.

Both images that were imported into the Sprites are PNGs.

So for example, the Turrent points to 90 degrees when the mouse is located at 0 degrees in front of the Sprite.

The Ship Sprite rotates 90 degrees before then moving according to the Arrow Key being pressed.
B
4
G
3
Posts: 22
Reputation: 944

Post » Sun Apr 25, 2010 5:04 am

Update:

I've sorted the Ship Sprite (8 Direction Behavior) by setting Rotation = None.
B
4
G
3
Posts: 22
Reputation: 944

Post » Sun Apr 25, 2010 5:20 am

Try facing the sprite that needs to point to the mouse position to the right, I've found that anything that will act like an arrow needs to face that way to look right.

If that doesn't help then I misunderstood the problem.
B
2
S
2
G
3
Posts: 114
Reputation: 1,553

Post » Sun Apr 25, 2010 6:53 am

Doesn't seem to make any difference once in Runtime state.

I've attached a screenshot to help show what I'm talking about. [url:1fbamrjt]http://img.villagephotos.com/p/2005-3/975381/TurretIssue.jpg[/url:1fbamrjt]

Oh; and I got my degrees wrong, its 270 not 90, or -90 :?
B
4
G
3
Posts: 22
Reputation: 944

Post » Sun Apr 25, 2010 7:06 am

Just so it's clear, did you match the angle of your sprite with it's own animation directions? I mean, did you paste an upwards facing sprite into the Right-facing direction? Doing so would cause the exact problem you have. Would need to add an Up-facing direction to solve (and remove the original right), or rotate your image withing the sprite editor.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Sun Apr 25, 2010 7:39 am

6Fix, the Animation Angle was the culprit...thus creating a new 270 degree Animation Angle solved the issue...many thanks indeed. :idea:
B
4
G
3
Posts: 22
Reputation: 944

Post » Sun Apr 25, 2010 10:48 pm

Hopefully this image explains it a little better:


[list:279fk2e9]
[*:279fk2e9]1. Draw the sprite so it is facing to the right[/*:m:279fk2e9]
[*:279fk2e9]2. If you drop an instance on the workspace it will look the same as in the editor[/*:m:279fk2e9]
[*:279fk2e9]3. But you can still rotate instances to face any angle in the editor[/*:m:279fk2e9]
[*:279fk2e9]4. The selected instance in this image has been rotated to 90deg - pointing downward[/*:m:279fk2e9]
[*:279fk2e9]5. For pivoting objects like this, you only need one animation angle:- 0deg, Right[/*:m:279fk2e9][/list:u:279fk2e9]

You can add event code to an object like this to make it point towards the mouse, like so:
[code:279fk2e9]+ System: Always (every tick)
-> Sprite: Set angle towards (MouseX, MouseY)
[/code:279fk2e9]

This will set the angle to the direction of the mouse pointer, so if you put the mouse on the right of the sprite it will set the angle to 0. This is why you should always draw rotatable sprites in such a way that they point to the right.
Hope this helps.
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

Post » Mon Apr 26, 2010 5:26 am

Cheers, thanks for the explanation.
B
4
G
3
Posts: 22
Reputation: 944


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests