Spring Object - Reverse Spring Effect?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Blackgaze
Posts: 46
Joined: Fri Aug 24, 2012 12:44 pm

Spring Object - Reverse Spring Effect?

Post by Blackgaze »

Hi, I'm working on a Sonic the Hedgehog DOOM wad. I'm trying to recreate a similar "spring" bells that pushes targets away when overlapping.

My current code works, however... its based on the direction the player is looking.

So a player overlaps a spring bell, gets pushed back. This part works fine
But if it collides another spring bell while being pushed backed it does not reverse the effects, as the direction of the player it the same it keeps getting pushed back the same direction, instead of the opposite.

How do I solve this issue?
ACTOR StarBounce : CustomInventory 23463
{
+NOGRAVITY
Inventory.maxamount 1
States
{
Spawn:
SPRG A 4 Bright
Loop
Pickup:
SPRG B 0 A_Playsound ("StarPing")
SPRG B 2 ThrustThing(angle*256/360+128, 50, 1, 0)
Fail
}
}
Please note I don't want to turn the player 180' when pushing. This would solve it, buts it's not the way I want the springs to work.

Return to “Scripting”