How do I make an Image Point not rotate with a sprite?

Get help using Construct 2

Post » Mon Sep 12, 2016 9:39 pm

I'm trying to set a health bar's position to a sprite's image point, but when the sprite's angle changes, the image point moves with it.

Is there a way to make it so the image point stays in the same place?

My current work around is to set the x and y of the health bar to the sprite's x and y then add whatever numbers to them to stick it where I want. But I want to make multiple sprites of different sizes and would like to stick the health bars to them in one chunk of code.

Thanks for any help.
B
8
S
3
Posts: 49
Reputation: 698

Post » Mon Sep 12, 2016 10:45 pm

One way around it is to have the offset distance applied by the sprite's width or height (or a combination of the two). So:

Set Healthbar position to:

X: Sprite.X + ( {Offset} * Sprite.Width )
Y: Sprite.Y + ( {Offset} * Sprite.Width )

Where {Offset} is a fixed value that determines how far from the origin of the sprite you want the healthbar to be, this example will give you a healthbar to the bottom right of your sprite.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Mon Sep 12, 2016 11:18 pm

B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Wed Sep 14, 2016 2:26 pm

@mrtumbles this was helpful, thanks!
B
18
S
8
G
6
Posts: 35
Reputation: 4,759

Post » Thu Sep 15, 2016 9:15 am

Welcome :)
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306


Return to How do I....?

Who is online

Users browsing this forum: evillair, gamecorpstudio, jorgmaquoi, Yahoo [Bot] and 24 guests