Fangames > Programming Questions

Changing the kids sprite on room warp

(1/1)

Skuttie:
So how do I permanently change the Kids sprite on room change? Say for 10 rooms I want him pink and then the next ten I want him blue, how do I go about that?

Keygrin:
What I would do is use a global variable that determines what sprites the character uses. Let's call it global.kid_color. Have the Player execute this code after using the warp that causes him to change color. An excerpt of how my crappy fangame in progress is coded:


--- Code: ---if global.kid_color=0
{
s_idle=thekid_idle
s_walk=thekid_walk
s_jump=thekid_jump
s_fall=thekid_fall
}
if global.kid_color=1
{
s_idle=thekidpink_idle
s_walk=thekidpink_walk
s_jump=thekidpink_jump
s_fall=thekidpink_fall
}

sprite_index=s_idle

--- End code ---

Skuttie:
Looks good, thanks!

Navigation

[0] Message Index

Go to full version