i have a problem with my character shooting.i need it to shoot the way it faces.right now it only shoots forward.So how do i get it to shoot the way its facing?
This issue with the bullet actor. You need to change the direction it is heading. double click on your bullet actor and use a accelerate or move behavior. Set the direction in the realm you wish the bullet to travel. Left is 180 and right is 0.
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
edited April 2012
To spawn an actor in the direction that the spawning actor is facing, use 90° relative to actor, assuming you want the bullet to come out of the top of the actor. Adjust the angle depending on where you want the bullet released. Then, on the bullet actor, it usually works to move the bullet 0 relative to the actor. I have a video that explains this:
the method dosent work.I think the reason is that the rocket rotates and My character changes images for the up,down,left and right positions.Its starting point is facing right so when i shoot it goes straight.Now if i go left it changes the image for the "facing left".Now when i shoot it goes backwards in the direction of its start point.So how can i fix this?
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
@johnydee187 You could either actually rotate the actor instead of changing images, or you could have separate conditions (When [changing image to left] spawn bullet 180°; When [changing image to right] spawn bullet 0°; etc.).
ok so i got the shooting to work right.But when i preview the scene my actor shoots a round automatically without me hitting the fire button.why does it do that?
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
Do you have a bullet actor on the scene? Go to Scene-->Layers and look in your layers to check for that. If you don't, post a screenshot of your actor's rules.
no i dont have a bullet actor on scene.I just have the rules when (fire button) is pressed change the attribute to true,otherwise false.in the charactor actor i have when(fire attribute is true) spawn the bullet actor.and in the bullet actor i have the "change velocity".its just like your video.
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
If you don't, post a screenshot of your actor's rules.
Do you have the Change Velocity behavior set to relative to actor or relative to scene? Also, if you put a different number in, such as 45 or 60, does it change the direction of the bullet to that angle?
i have the change velocity set to relative to actor.and i put a number in but didnt change the bullet direction.So iam confused here.i cant find whats spawning the bullet actor before i hit the fire button.it only shoots once automatically when i preview the scene.
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
I really can't help you without screenshots or a game file. You're welcome (if you have Dropbox or want to use mediafire, etc.) to post a link to your game file and I can help you.
nevermind i figured it out...the problem was that in the boolean attribute, it was checked on.I guess somehow in someway it was making the attribute true at the start..
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User