Author Topic: Sprite State...  (Read 3753 times)

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Sprite State...
« on: 2008-07-27, 08:32:20 AM »
How do I fix this problem?

I've made a sprite that easily switches states when rules are called- but when I add new states and I call a rule to switch to one of them - the sprite stays in that state irregardless to the rules acting on it.
    what I want:<Spin Dash right -> Stand right> what happened:<Spin Dash right X Stand right>
I found that all of the sprite states must be the same length and height, for this not to happen and that worked for my "Sonic" sprite...

But for my boss sprite I tried the same thing- but when it runs right-It stays running right (State) irregardless to its "IF moving left" "DO Switch to state 'run left' " rule

any advice?...

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Sprite State...
« Reply #1 on: 2008-07-28, 05:21:40 AM »
If your states are different sizes, you're only allowed to switch states if the new state doesn't cause the sprite to overlap solid ground.  For example, if you duck to get into a tunnel and you're ducking through the tunnel, you won't be allowed to stand up.  If you don't align the states correctly, you might be causing a larger state to overlap the ground you're standing on, which would prevent you from switching to that state.  You have to select the right relative position parameter (maybe align the bottoms of the states when switching to make sure the bottom of the new state isn't below the bottom of the old state) to ensure the new state doesn't overlap solid areas of the map.