Author Topic: change player state when shooting  (Read 6203 times)

timmyslasttry

  • Guest
change player state when shooting
« on: 2005-03-24, 07:56:26 AM »
I need to change my player's expression when shooting fireballs.  I have the shooting part down, I just don't know how to cycle in the frame of the player's shooting motion.  Please help.
Thanks!

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Wie fiele?
« Reply #1 on: 2005-03-24, 10:30:58 AM »
How many times would you say that's been addressed, Red three?

*chkst* I'd say about three on the guns, three on the towers *chkst*

So, you have a walking sprite (left/right for this example) that has, say, 6 frames in each animation (6 for walking left, 6 for walking right).  Then, create a sprite that has 6 frames of animation for each shooting state (6 for shooting left, 6 for shooting right).

Create an invisible inventory item called "isNotShooting", initial value 3, max 3.

Then, create a global special function that is activated when the fire button is pressed, which requires 2 isNotShooting inventory and uses them up which does the "Switch to a new sprite" function.  Switch to the firing sprite, retain old state, in same location as old, delete old sprite.

Create another global special function that adds one to the isNotShooting inventory constantly.

And finally, create a third special function that requires three isNotShooting inventory which switches back to the old sprite, same flags as the first special function.
Edward Dassmesser

timmyslasttry

  • Guest
Thanks, but still need help
« Reply #2 on: 2005-03-24, 01:42:36 PM »
You've got me on the right direction , but I still can't get it to work.  My sprite just disappears.  Maybe is has something to do with the 2nd, special function, I don't see anything about 'adding' or 'continuously'  Did you mean add player interaction?  Please help.  I'm a beginner, so you'll have to be pretty descriptive.  THANKS.
-Ryan

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
change player state when shooting
« Reply #3 on: 2005-03-25, 06:24:51 AM »
Can you think of anything in your project/design that would cause the player sprite to be deleted?  The only thing I can think of is the "Delete old sprite" checkbox on the switch to sprite function.  But that should never leave the sprite completely gone because it should always be creating a new sprite at the same time... unless maybe you switched to the same sprite that you are deleting.

timmyslasttry

  • Guest
re:
« Reply #4 on: 2005-03-25, 09:16:36 AM »
Here's where my hangup is:


Create another global special function that adds one to the isNotShooting inventory constantly.

I don't understand.

Please clarify.

Thanks.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
change player state when shooting
« Reply #5 on: 2005-03-27, 02:11:41 PM »
Create a special function in the Special Functions tab.  The function is to "alter inventory".  Have it add 1 to the isNotShooting inventory.  Check "Global (Covers entire map)" in the activation parameters.

That's it.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Reasoning
« Reply #6 on: 2005-03-28, 06:59:21 AM »
The purpose if the function that adds 1 to isNotShooting is to "notice" when you stop shooting.  As long as you continue to shoot, you will continue to use up these items faster than they can be replenished, but once you stop pressing the button, the function in question will allow the count of isNotShooting to get back up to 3, and when that happens the other function can activate that switches the sprite back to the non-shooting state.

Guest

  • Guest
change player state when shooting
« Reply #7 on: 2005-04-29, 07:30:30 AM »
I tried the technique but my sprite just flickers and moves slowly. Is there any way to fix this?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
change player state when shooting
« Reply #8 on: 2005-05-01, 07:12:25 AM »
I tried a small test project and noticed that this method isn't perfect.  However I did notice one important possibility for improvement.  It works better if you check the box for "new instance" on your switch sprite functions, otherwise it will delete the player sprite half the time (causing it to flicker).  I guess there's still room for improvement in the GameDev engine there.  This might not be perfect, but it'll be a little better.  I haven't had time to come up with a better suggestion.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: change player state when shooting
« Reply #9 on: 2006-01-09, 06:35:05 PM »
Hey, that's a really good idea! I'm gonna tweak that so my player is temporarily invulernable when he's hit! Thanks  :)