SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 03-27-2017   #1
Lach
what the thok mate??
 
Lach's Avatar
Default Under what circumstances is PF_SPINNING removed?

I'm using a ThinkFrame hook so that under a certain condition, PF_SPINNING is added to the player flags.

Code:
	if player.cdspin
		player.mo.state = S_PLAY_ATK1
		player.pflags = $1 + PF_STARTDASH
		player.pflags = $1 + PF_SPINNING
	end
However, when I open devmode, I see the PF_SPINNING indicator alternating between true and false every tic, even when the condition is constantly true. Why is PF_SPINNING being removed?

EDIT: For some reason, checking for a missing player flag first before adding it fixed the issue. I'm still curious as to what the issue was, though. Does adding a player flag when it's already added remove the flag?

Last edited by Lach; 03-27-2017 at 04:10 AM.
Lach is offline   Reply With Quote
Old 03-27-2017   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Try using $1|PF_STARTDASH instead of $1 + PF_STARTDASH and likewise for PF_SPINNING, using | (known as bitwise "or") instead of + makes sure adding the flag doesn't do something weird if the flag was already set.
Monster Iestyn is offline   Reply With Quote
Old 03-27-2017   #3
Lach
what the thok mate??
 
Lach's Avatar
Default

Oh, okay. I'm not too familiar with the bitwise operators yet; guess this is the opportunity to learn them. Thank you!


Since I don't want to make two threads in one day, is there any way for Lua to detect the forward button apart from cmd.forwardmove? It doesn't seem to register it while the player is in the S_PLAY_PAIN state.
Lach is offline   Reply With Quote
Old 03-27-2017   #4
toaster
トースタちゃん
Developer
 
toaster's Avatar
Default

Yup, that's intentional. It appears the commands recieved from the keyboard aren't processed in the pain frame.

You could get around this by creating a new state with the same sprite and frame as S_PLAY_PAIN and setting the player to that. It'll break the hardcoded no-key-presses stuff, but the player will start flashing early, so it's up to you if you want to make that tradeoff.
__________________
Quote:
<MonsterIestyn> surely it's good ass though
Quote:
<MonsterIestyn> watch porm to keep warm
toaster is offline   Reply With Quote
Old 03-27-2017   #5
Lach
what the thok mate??
 
Lach's Avatar
Default

Yeah, I figured it was intentional, but I wanted to see if there was another button indicator that I wasn't aware of before I tried using custom states. Thank you though!

Am I correct in assuming that defining a state's sprite parameter as PLAY as well as the frame of my choice will automatically use the frame from the character's skin? (I'm about to go to bed so I can't test it yet.)
Lach is offline   Reply With Quote
Old 03-27-2017   #6
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Yes it would, assuming you're using it on the player or another object with a skin set. SPR_PLAY is basically a special sprite prefix that swaps itself with the sprite set of the object's current skin.
Monster Iestyn is offline   Reply With Quote
Old 03-27-2017   #7
Lach
what the thok mate??
 
Lach's Avatar
Default

Okay sweet, so I don't have to add an unnecessary SPR set. Thank you both for your help on such noob questions!
Lach is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:37 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.