Pages: 1
Topic closed
If a sprite is pointing left and I want it to do a attack only for the left side or the same thing only right or left how do i do it.
What i mean is link from legend of zelda attacking one derection then if pointing in the other derection a attack that way
Offline
Depends on how you are going to do you attack.
If it is melee - like a sword or fist - then if you have a costume change for attacking it will automatically be in the right direction - make the weapon a distinctive colour and give the monsters an "If touching colour (weapon), Die" script.
If its for shooting, the easiest way might be to set a variable "facing" in a forever loop on your main sprite - "set facing = Direction (using the direction indicator under the motion tag). Then you can use this variable to set the direction of your attack.
Offline
Can you tell us:
What is doing the attacking?
(eg - A man, a tank, a spaceship)
What are they are attacking with?
(Eg A sword, a fist, a gun, a laser)
Do they always attack in the direction they are facing?
(Yes - the man aways attacks in front of him or No - the tank can shoot in a different direction to where it is facing)
Offline
If you want it to attack in a different direction than it's facing, without a lot of extra costumes, use another sprite with
When flag pressed
forever
goto (whatever main sprite is)
attacking code
end forever.
I've got a demonstration here -> http://scratch.mit.edu/projects/Bloing_Gloing/4384
For instance, you could use an arm, which rotates around the shoulder, and points to a different direction for a key you press.
Last edited by Bloing_Gloing (2007-05-30 07:10:32)
Offline
Is this the sort of thing you mean?
http://scratch.mit.edu/projects/LT/1707
Offline
Have any of you played a game boy advanced legend of zelda?
what T mean is that If links facing back he does a backwards attack, he walks foward the attack looks diffrent then the back attack, thats what I mean
Offline
Topic closed
Pages: 1