Get shoot left and right
Hey all,
I've searched the forums and tried the suggestion with no luck. Currently I have When space bar is pressed, spawn bullet actor@ "0" angle. It shoots to the right no prob. shoot left is the issue.
After reading the forums I tried this:
Created a boolean game attribute called Rightfacing.
In my actor I have:
--When right key is pressed, AND, attribute Rightfacing is TRUE
----Move actor@ "0" angle.
--When Left key is pressed, AND, attribute Rightfacing is FALSE
----Move actor@ "180" angle.
-Shooting:
--When spacebar is pressed AND attribute Rightfacing is TRUE
---Spawn bullet actor.
This is as far as I got because when previewing my actor now does NOT shoot at all. What I am I missing? What remains to be added to the SHOOT is: when Rightfacing is FALSE spawn bullet actor=angle@180.
Thanks for any advice,
Alan
Comments
Here's one way to do it:
https://www.dropbox.com/s/yhy5y0ckfvmy8gq/shoot arrows.zip
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
You don't need to change the 'direction' in the spawn behaviour for either right or left, the spawn behaviour spawns an actor at a location of the screen - and with a rotation (if you want) - the rotation is confusingly called 'direction' (it really needs to be changed to 'rotation') - beyond position and rotation the spawner has no other influence on the actor it is spawning. Where the actor moves, in which direction, at what speed - and so on - is defined by the rules in the actor being spawned.
@Tatiang: Thanks again for help again. I tried to copy your settings but no luck.
In my case I have walking animation for Right & Left. So flipping the graphic is different. I tried to understand your shooting code. When you have "self.graphic.FlipHorizontal" are you still flipping the archer? I have a feeling that this code would not work again because I am not flipping a graphic for right/left.
Do you have advice for an actor with a right&left animation?
Thanks!
Alan
...Added note.
The game I'm working on is kinda like minigore in that the actor moves up&down, and right&left. When he moves up and faces right he shoots while moving. I need help to figure out how to make him shoot when he faces left while moving up&down.
I just tried to put the shooting at angle "0" in the my Move Right rule thinking I would just do the opposite for the Move Left rule. No luck, plus it won't shoot if I move up or down.
Thanks guys!
ALan