Change Sprite HotSpot in Runtime

For questions about using Classic.

Post » Mon Aug 02, 2010 12:51 pm

Is this possible? I don't find any way to do this. :?
But if it isn't possible, is there anyway of making it always in the center of the sprite?

Thanks.

PS: And is there any way of managing the points in runtime?
B
6
S
2
G
6
Posts: 48
Reputation: 2,936

Post » Mon Aug 02, 2010 6:37 pm

You can't change imagepoints or hotspots at runtime, however the s plugin has math expressions that are the equivalent of imagepoint rotations, called get offset something or other
You basically put in the x and y offsets, and the original sprite coordinates and angle, and it tells you the x and y coordinate it would be at rotated at that position.

If you're going to be resizing there is a little more math.
Let me know and ill try to get an answer if my job ever let's me leave
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Aug 02, 2010 7:43 pm

Sprites can have animation frames with different hotspots,so you can cycle a sprite with your predetermined hotspot
You can also set up multiple image points for position
Also numpad 5 will center the hotspot/imagepoint right in the middle
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Mon Aug 02, 2010 7:49 pm

Well, I'm creating an aircraft game and the ships are dynamic. They're loaded into the game from a folder and an INI file. So I'm using the Physics Behavior, and the ship is always turned to the mouse position. And so, if I have an image and I have the default image points position, and I need to know what is the point position relatively to the ship's position and angle. Can you give me an exemple/site where it explains the math I need to get this, and also How to totate the ship from it's center?
And the resizing will be done to create thumbnails of the image to be represented in the "garage".

Thanks. :)
B
6
S
2
G
6
Posts: 48
Reputation: 2,936

Post » Tue Aug 03, 2010 2:23 am

[url:21dx10j0]http://dl.dropbox.com/u/1013446/imgpts.cap[/url:21dx10j0]
you'll need the s plugin to run the cap
[url:21dx10j0]http://dl.dropbox.com/u/1013446/Plugins.rar[/url:21dx10j0]

if you just want to test it without downloading the plugin here:
[url:21dx10j0]http://dl.dropbox.com/u/1013446/imgpts.exe[/url:21dx10j0]
to use double click to add an "imagepoint"
hold right mouse button to rotate sprite


the names of the expressions when searching for an expression are Get Rotated X from Offsets and Get Rotated Y from Offsets

[code:21dx10j0]S.xoffrot(origin x, origin angle, x offset, y offset)[/code:21dx10j0]
and
[code:21dx10j0]S.yoffrot(origin y, origin angle, x offset, y offset)[/code:21dx10j0]
for example, you have a sprite called sprite, and you wanted to add an imagepoint at runtime at position 4,5
S.xoffrot(sprite.x, sprite.angle, 4, 5)
S.yoffrot(sprite.y, sprite.angle, 4, 5)
[size=50:21dx10j0]

other advanced features like being able to stretch the sprite and have the imagepoint stretch,
or being able to add an imagepoint while the sprite is already rotated and get the correct offsets are both automated through expressions with 's', but not worth posting here, unless you decide you want to work with it.

also, if you fall deeply in love with 's' and decide to dedicate yourself to learning the arcane arts of 's'ness, there are actions that will automatically generate an array of offsets for you from a an array of sprites, and other weird craziness[/size:21dx10j0]
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Aug 03, 2010 4:56 am

There are expressions for vertex x, and vertex y for a sprites distortmap, but it only returns absolute coords.... I'm wondering if that's a bug, or if it might need a switch to choose relative.

Any way if that was different would that work just the same as a point?
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Aug 04, 2010 3:50 pm

Can someone give me the S plugin url? I can't find it. :?
B
6
S
2
G
6
Posts: 48
Reputation: 2,936

Post » Wed Aug 04, 2010 4:26 pm

Unless I somehow posted the wrong link its in my previous post
The one that ends in plugins.rar
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Aug 05, 2010 3:32 pm

Oops, sorry... :oops:
Thanks for everything, I'll see your example. :)
B
6
S
2
G
6
Posts: 48
Reputation: 2,936

Post » Thu Feb 11, 2016 2:49 pm

Hi !

a few years after 2010 (your post !) i need a plugin to change Hotspot of a sprite during runtime.

in fact, i want to do a zoom on the point of a sprite i am cliqued.

can you help me or give me an new url?

thanks
B
8
S
1
Posts: 67
Reputation: 596

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests