I've got part of it figured out.
The enemy can run toward the player, then at a certain distance they will shoot.
I just want to know how to have them aim at you. I guess you can have the arm with the gun a separate sprite to do this.
What should I do?
Offline
Once they are in position to shoot, they can broadcast a message that a bullet sprite receives to fire. However, this would require a separate broadcast message for every enemy and a bullet sprite for every enemy.
You can insert a script like this into each bullet sprite:
http://img32.imageshack.us/img32/1143/scriptd.gif
And a script like this into each enemy sprite:
http://img708.imageshack.us/img708/6850/script.gif
Obviously I don't know specific numbers like the speed of the bullet or distance of the enemy but hopefully you get the idea.
Last edited by Kileymeister (2012-01-15 18:22:55)
Offline
If using the arm with the gun as a seperate sprite (this method looks more realistic) do
When distance to player < 50(or any number)
Point towards player
Broadcast Shoot
Then on the bullet put:
When I recieve shoot
point towards player
Repeat until touching player
Move 10 steps
wait 0.05 secs
End Repeat
Wait 0.5 Secs
Hide
Go To Enemy
That should work.
Offline
The problem is that the arm sprite moves a little weird. When the good guy sprite is behind the enemy, the arm goes down to the enemy's legs. How can I get the arm to rotate from a fixed point on the enemy?
Offline
plb36 wrote:
Okay, try this.
If direction < (fixed point 1) and direction > (fixed point 2)
Point towards player
End If
For a better visual look at this
Hope this helps!
That would probably cause the arms to get stuck once they leave those boundaries, I believe you meant this.
Last edited by Kileymeister (2012-01-15 19:43:43)
Offline
I see. You're right, that works better.
Offline
It's not working. The arm only follows the player on one side of the enemy. What if the player is on the other side? There's also some flickering in the arm. What I meant was for the arm to rotate, but have its center (shoulder) at a fixed point. I want the arm to pivot on that point.
Offline
well if you hit an armed man in the face, he will shoot at you. im not sure if thats what you mean
Offline
haloman298 wrote:
It's not working. The arm only follows the player on one side of the enemy. What if the player is on the other side? There's also some flickering in the arm. What I meant was for the arm to rotate, but have its center (shoulder) at a fixed point. I want the arm to pivot on that point.
Okay, I see your problem.
First, go to the arm costume.
Now, click edit.
Click "Set Costume Center"
Align the center of the crosshairs with the point you want it to rotate around.
That should work (unlike the other two times I tried to help)
Hope this helps!
Offline
plb36 has hopefully hit the nail on the head. Sorry about us being unable to figure out the problem before. That should do it, and I suggest to clean up any other cosmetic conundrums that to prevent the arms from being upside down when facing left, create a costume of the arms upside down and apply this script:
http://img189.imageshack.us/img189/6850/script.gif
Hopefully that doesn't confuse matters further.
Last edited by Kileymeister (2012-01-16 08:14:16)
Offline
Actually, by just playing around with it I finally got it to work! Thanks!
Offline
ya just make the gun or whateves a separate sprite. then use the block that says "point foward " in the motion section then go to the down arrow and click " mouse pointer ". then that should be it tell me if you need more advice.
/\_/\
I ' . ' I CatPerson - tell me if you like this cat and Ill make you an animal like this
Offline