This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-05-29 16:08:00

liphttam1
Scratcher
Registered: 2007-05-16
Posts: 30

If pointing in derection do this in that derection do that

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


http://www.readwritethink.org/lesson_images/lesson936/butteredtoast-200.jpg

Offline

 

#2 2007-05-29 16:19:46

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: If pointing in derection do this in that derection do that

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.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-05-30 06:31:54

liphttam1
Scratcher
Registered: 2007-05-16
Posts: 30

Re: If pointing in derection do this in that derection do that

thats not what i mean, the attack changes the look of it for every derection.


http://www.readwritethink.org/lesson_images/lesson936/butteredtoast-200.jpg

Offline

 

#4 2007-05-30 06:58:23

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: If pointing in derection do this in that derection do that

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)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2007-05-30 07:09:13

Bloing_Gloing
Scratcher
Registered: 2007-05-11
Posts: 27

Re: If pointing in derection do this in that derection do that

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

 

#6 2007-05-30 15:12:42

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: If pointing in derection do this in that derection do that

Is this the sort of thing you mean?

http://scratch.mit.edu/projects/LT/1707


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#7 2007-05-30 15:25:39

liphttam1
Scratcher
Registered: 2007-05-16
Posts: 30

Re: If pointing in derection do this in that derection do that

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


http://www.readwritethink.org/lesson_images/lesson936/butteredtoast-200.jpg

Offline

 

Board footer