Project X Forums
http://px.worms2d.info/forum/

Modify mole weapon
http://px.worms2d.info/forum/viewtopic.php?f=13&t=2081
Page 2 of 2

Author:  Resurrection [ Mon Aug 01, 2016 4:14 pm ]
Post subject:  Re: Modify mole weapon

Z
Zed wrote:
Using setspriteoverride with a new sprite is possible, but it wont allow for an animation, because it wont have rotation then (mole sprite is already 'animated' with rotation).


It was actually possible. I extracted the digging, walking and jumping animations and made them transparent .png's which i then overrode. The issue is now there cant be a normal mole sprite animation. Your suggestion is probably the best way to do it if there is no way to call spriteoverride another time, which does not seem possible. It can only run one time before the sprite is loaded in to memory.

Author:  Resurrection [ Mon Aug 01, 2016 7:49 pm ]
Post subject:  Re: Modify mole weapon

Trying to implement it now using AddSpriteEx. The rotation parameter is tricky because who knows the name of the mole rotation variable?? its not rot.. maybe because its a missile its possible to get velocity normal/direction? (is this SpX and SpY)?

Author:  Zed [ Tue Aug 02, 2016 2:39 am ]
Post subject:  Re: Modify mole weapon

I don't think CMissile has a rotation var, animframe probably taken straight from spx and spy, as you say.

Try pyro's sprite builder for help. I found this in it:

float WeapSprite::CalculateAngle(float sx, float sy)
{
local a = -atan2(sx, sy) - MATH_PI + MATH_PI * rotation;
rot = a;
return rot;
}

rotation apparently is one of the params directly inputted to find the 'head' of the sprite.

Author:  Resurrection [ Tue Aug 02, 2016 5:03 am ]
Post subject:  Re: Modify mole weapon

Interesting function. I wonder why it subtracts PI and then adds it again.
Figured it's very easy to calculate direction by checking x,y coordinates every frame instead. And then maybe average it out a little to make it smooth.

Image

It's a kamikaze-mole, u see it?

Author:  Zed [ Tue Aug 02, 2016 5:26 am ]
Post subject:  Re: Modify mole weapon

Yes, it looks like it has a dynamite with a clock on it :P

Author:  Resurrection [ Wed Aug 03, 2016 1:15 am ]
Post subject:  Re: Modify mole weapon

How does the explode timer work? Can't set it anywhere.
Tried to edit it in weapon editor :(
and edit the MagicMoleExplodeTimer var you made :(
nothing works.

And mole does not sink in water. The timer stops and u can stay under water with mole until Anti glitch starts.
Edit: It was because when mole sinks there is a force down but if you press UP you can beat it. Have to check if mole is under water and disable keys.

by the way, the rotation is now working with custom sprite but its really weird.. had to bruteforce the right values. I made code very bad, don't look at it. :oops:

Author:  Zed [ Wed Aug 03, 2016 3:08 am ]
Post subject:  Re: Modify mole weapon

Mole has two explosion timers, one for walking part (10s), one for digging part (20s). The first is in Explosion (wep editor), the second is in Clusters-Explosion.
MagicMoleExplosionTimer is not an explosion timer :D Sorry name is not fitting

Page 2 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/