Making a Pickup Bounce
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!)
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!)
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
Making a Pickup Bounce
It seems like all Bounce flags and properties affect only missiles / projectiles, Is there a way to do it with Pickups ?
-
Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: Making a Pickup Bounce
What kind of bounce specifically do you want? (and why is a pickup bouncing around anyway?)
There might be a way to fake it with A_ChangeVelocity and CheckMove.
There might be a way to fake it with A_ChangeVelocity and CheckMove.
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: Making a Pickup Bounce
It's a pickup that the player drops after he gets damaged, I want it to bounce after falling, I want the bounce strength to change depending on how fast the item falls, what does CheckMove do?
-
Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: Making a Pickup Bounce
CheckMove checks if an actor can move to a given set of XY coordinates, letting you check whether there's a blocking actor or line. I mention it in case you needed horizontal bouncing.
For vertical bouncing off the floor only it can be much simpler:
For vertical bouncing off the floor only it can be much simpler:
Code: Select all
override void Tick(){
// if it's on the ground and moving downwards,
// make it move upwards instead but not as fast
if(
vel.z<0 &&
pos.z<=floorz
){
vel.z=-vel.z*bouncefactor;
}
// do all the other ticky stuff
super.Tick();
}