Firing a Weapon
link.tothepast
Member Posts: 15
What behaviors do I use in order to fire a weapon in a game?
What behaviors do I use in order to fire a weapon in a game?
Comments
To get anything to happen in GameSalad, you'll need to have a Rule condition. Most likely, you'll want an attribute value (e.g. a boolean called game.fire set to true) as the condition. When the rule triggers, you can spawn another actor (e.g. a bullet). In the bullet actor, have a Move or Accelerate or other behavior that actually moved it in a certain direction.
To trigger the rule, you might have a button actor on screen that When Touch is Pressed changes attribute game.fire to true. You'll also want to reset the value by doing Timer after 0.1 seconds (check the box marked run to completion) change attribute game.fire to false so that it's ready to change again when you next click/tap the button.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User