PDA

View Full Version : Sprite Coordinate Question


Alpho
01-16-2015, 05:17 AM
Hello!

I'm trying to make a cape system. What is the best way of going about this? I was thinking a script within a gani and setting that as an attr on your player, but then you have the problem where sprites move around (walking gani for example). Is there any way to find the position of a certain sprite? Maybe there's an easier way of going about this?

Thank you!

MysticalDragon
01-16-2015, 05:35 AM
Hello!

I'm trying to make a cape system. What is the best way of going about this? I was thinking a script within a gani and setting that as an attr on your player, but then you have the problem where sprites move around (walking gani for example). Is there any way to find the position of a certain sprite? Maybe there's an easier way of going about this?

Thank you!

Inside a gani you could do;

SCRIPT
function onPlayerEnters() {
with ( findImg( 100 ) ) {
image = player.attr[#];// Image of Cape
layer = 2;
attachToOwner = true;
attachOffset = { -1, -3, 0 };
}
}
SCRIPTEND


But from my knowledge there is no way to tell exactly where the sprite location is inside the gani, at least not that i know of. Although there is getspriteforspritepos(obj) - returns object, but i never used it.

Alpho
01-16-2015, 05:38 AM
Inside a gani you could do;

SCRIPT
function onPlayerEnters() {
with ( findImg( 100 ) ) {
image = player.attr[#];// Image of Cape
layer = 2;
attachToOwner = true;
attachOffset = { -1, -3, 0 };
}
}
SCRIPTEND


I know, I already had something like that. What my question was is if we can find the position of a certain sprite. For instance, finding the coordinates of the body in all views so that you can position the cape correctly.

xAndrewx
01-17-2015, 05:41 AM
Ideally, I think you'll need to edit every ani to include the attribute. (You could script this)