New player states?

OtherChen

The other one
I've noticed that I can directly set the player's mobj state in Lua, and animated states work just fine. For instance,
Code:
p.mo.state = S_PLAY_ROLL
correctly sends the player into their rolling animation, even if I remove or change some of the frames in the WAD.

I want to make a character crouch, and possibly crawl, by pressing SPIN while not running. I can't find a way to use S_PLAY_* states to do that.

  • S_PLAY_FIRE seems to animate the sprite properly, but prevents the player from changing direction, and the crouching frame lingers for a while.
  • S_PLAY_GLIDE, S_PLAY_SPINDASH, and a few others are looping animations, which cause the player to vigorously T-bag until their state changes.
  • S_PLAY_LAND (à la Knuckles and Fang) doesn't exist... Is there another name for this state?
  • My character uses CA2_MELEE while running, so those states are out.

Are there any other spare states I can use, or is there another way to at least get crouching to work? As of now, the wiki doesn't seem to have the latest info on this new animated sprites thing.
 
Last edited:
You can freeslot some states and "sprite2"s to build your own state for this purpose. Sprite2 constants begin with the prefix "SPR2_", and the constant lives in the frame field of the state; it's otherwise exactly like freeslotting other stuff.
 
I didn't end up making my own states; I ended up using melee states for crouching, and "boost mode" states for crawling.
Side note: player.height exists now, allowing you to set height without changing scale -- perfect for crouching! I bet setting player.radius would let you squeeze through gaps too, if the map allows it...
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top