Author Topic: Changing the kids sprite on room warp  (Read 1515 times)

Skuttie

  • Wannabe
  • Posts: 9
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 46.0.2490.80 Chrome 46.0.2490.80
    • View Profile
  • Playstyle: Keyboard
Changing the kids sprite on room warp
« on: November 01, 2015, 12:00:09 AM »
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

  • Wannabe
  • Posts: 19
  • Keygrin
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 41.0 Firefox 41.0
    • View Profile
    • Keygrin
  • Playstyle: Keyboard
Re: Changing the kids sprite on room warp
« Reply #1 on: November 01, 2015, 12:58:00 AM »
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: [Select]
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
YouTube Channel

I await the day I die! Living is meaningless to me.

Skuttie

  • Wannabe
  • Posts: 9
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 46.0.2490.80 Chrome 46.0.2490.80
    • View Profile
  • Playstyle: Keyboard
Re: Changing the kids sprite on room warp
« Reply #2 on: November 01, 2015, 10:21:15 AM »
Looks good, thanks!