Ok I know lots about scratch and made some projects that I've never posted (some due to randomly grabbing pics from internet and can't find them to give credit. ), but I can't figure out how to make a real time fighting aspect to my action adventure game. I have separate costumes for attacking while facing in each direction (by pressing space), but I can't figure out how to make it so that it chooses which costume based on which direction it is facing. Could someone explain some way to make it work. If it's not possible at least something similar?
Offline
here you go (I made it presuming if you press an arrow key you face a certian direction): <when green flag clicked><if><key[ right arrow ]pressed?><next costume>( as many costumes that you want to switch to get the entire fighting move down) then just duplicate it and instead of right arrow key pressed make it left arrow key pressed and change the costumes foer the fighting sequence
Offline
But that doesn't work with the rest of my game. There are two costumes for each direction that alternate for a walking motion. I'm using the Fruit Craft RPG that comes with scratch and adding onto it to make an epic game.
Would making a separate sprite for the weapon and controlling it with the mouse work? Like somehow make the sprite rotate so it always points toward the mouse then move forward then back when I click?
Also reading some more of the forum I don't know NEARLY as much about scratch as I thought I did. XD
Offline
well heers a script to make a gun: When green flag clicked
forever
Set X position to X Position of Character
Set Y position to Y Position of Character
/forever
Offline
Ok. I'll experiment some more and see if I can figure out some way for this to work.
Offline
here it is in terms of blocks;<forever><go to x the position of the character )y the position of the character
Offline
Ok Thanks.
Offline
and if you still have questions check out my project: http://scratch.mit.edu/projects/4lover/1975649 and download it because it uses a gun XD
Offline
Ok sweet. Thanks!
Offline
your welcome
Offline
4lover wrote:
here it is in terms of blocks;<forever><go to x the position of the character )y the position of the character
That won't work, you need to make it go to x position of character holding gun plus something.
Offline
Gemini8910 wrote:
But that doesn't work with the rest of my game. There are two costumes for each direction that alternate for a walking motion. I'm using the Fruit Craft RPG that comes with scratch and adding onto it to make an epic game.
Would making a separate sprite for the weapon and controlling it with the mouse work? Like somehow make the sprite rotate so it always points toward the mouse then move forward then back when I click?
Also reading some more of the forum I don't know NEARLY as much about scratch as I thought I did. XD
Walking Script:
[blocks]
<when green flag clicked>
<forever>
<if><( <direction> <>> 180 )>
<if><key[ Left Arrow ]pressed?>
<switch to costume[ walkLeft1
<wait( 0.3 )secsc>
<switch to costume[ walkLeft2
<change x by( -4
<else>
<if><key[ Right Arrow ]pressed?>
<switch to costume[ WalkRight1
<wait( 0.3 )secsc>
<switch to costume[ WalkRight2
<change x by( 4
[/blocks]
Turning Script:
[blocks
<when green flag clicked>
<forever>
<if><key[ Left Arrow ]pressed?> <or><key[ Right Arrow ]pressed?>
<if><key[ Left Arrow ]pressed?>
<point in direction( -90
<if><key[ Right Arrow ]pressed?>
<point in direction( 90
[/blocks]
Last edited by DigiTechs (2011-08-24 07:22:31)
Offline
Thescratch3 wrote:
4lover wrote:
here it is in terms of blocks;<forever><go to x the position of the character )y the position of the character
That won't work, you need to make it go to x position of character holding gun plus something.
No it will always go to the character you just have to set costume center so it doesnt go to the middle of the character
Offline
OK I think I have a working script using the mouse. Just have to work out a few kinks and I'll be good. Until I have another question of course. XD
Offline
ok XD
Offline