Changing direction of bullet curve depending on player movement
UIC_BamBam
Member, PRO Posts: 5
Heya,
In the game I'm creating, the player can shoot bullets in 4 directions (I did this by just doing an attribute that is set to true for each direction on the virtual dpad, and then defining the speed and direction in the player sprite for each attribute. My problem is that am wanting to have a bit of a curve when the player is shooting in a direction and strafes (Meaning that if the player was moving down and shooting right, the bullets would move in a slightly downward direction). I'm pretty new to Gamesalad, so any help would be appreciated ^^'
Comments
@UIC_BamBam Set up some bolleans based on which direction your shooting...then add a rule that uses a move attribute when Boolean is true.
When shooting left make shoot left Boolean true...in bullet actor place the rule when shoot left is true move 270 degrees at speed 8 or so.
something like that head you in the right direction to try?
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Oh shoot, I feel kinda stupid now for not realizing that ^^'
Thank you, I got it working!
Oh actually, I just realized. Now I have an issue. When I start shooting and move up the bullets do curve upwards, but all of the already shot bullets do as well.
Hmmm ok...maybe place a timer and imbed the rules of the bullets...use the "for" attribute. Give the bullet some time to move across the screen before you destroy it...should it not hit its target.
That should make the bullets act individually as you will be creating a singular action of each bullet. I think.
You are destroying bullets that don't collide right?
Tag me if you respond so I know you have in this thread please. @UIC_BamBam
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Ahh nevermind. I just added in an angle attribute and changed the original spawn direction of the bullets depending on which attributes are true. Thank you for the help though! @Thunder_Child
You could make the bullets accelerate towards whatever direction the player is moving while still shooting in a direction.
To use your example, the player is moving down but the bullet is firing to the right.
So, in your bullet actor:
If game.playerismoving is true
and
game.direction is south
Accelerate towards (south)
Adding a minor accelerate in addition to shooting up, down, left, or right should make the bullets do that curve effect you wanted.
I could be completely wrong, though.
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
That sounds pretty similar to what I did, maybe I will try it with acceleration instead of move to give it a smoother transition. Thank you!