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

#1 2011-08-23 22:52:43

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Real Time Fighting for Action Adventure?

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.  sad  ), 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.  hmm  Could someone explain some way to make it work. If it's not possible at least something similar?

Offline

 

#2 2011-08-23 23:00:31

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

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


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#3 2011-08-23 23:12:28

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Real Time Fighting for Action Adventure?

But that doesn't work with the rest of my game.  sad  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.  big_smile

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

 

#4 2011-08-23 23:27:40

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

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


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#5 2011-08-23 23:33:47

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Real Time Fighting for Action Adventure?

Ok.  smile  I'll experiment some more and see if I can figure out some way for this to work.  smile

Offline

 

#6 2011-08-23 23:37:13

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

here it is in terms of blocks;<forever><go to x sad  the position of the character )y sad  the position of the character


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#7 2011-08-23 23:39:37

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Real Time Fighting for Action Adventure?

Ok Thanks.  smile

Offline

 

#8 2011-08-23 23:41:01

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

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


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#9 2011-08-23 23:51:39

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Real Time Fighting for Action Adventure?

Ok sweet.  smile  Thanks!  big_smile

Offline

 

#10 2011-08-23 23:54:25

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

your welcome


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#11 2011-08-24 00:22:36

Thescratch3
Scratcher
Registered: 2011-06-14
Posts: 1000+

Re: Real Time Fighting for Action Adventure?

4lover wrote:

here it is in terms of blocks;<forever><go to x sad  the position of the character )y sad  the position of the character

That won't work, you need to make it go to x position of character holding gun plus something.


View my projects. Or face The scratch curse! (Get it?)
http://i56.tinypic.com/2cdk8hy.png

Offline

 

#12 2011-08-24 07:16:05

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Real Time Fighting for Action Adventure?

Gemini8910 wrote:

But that doesn't work with the rest of my game.  sad  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.  big_smile

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)


I'm back.
Maybe.

Offline

 

#13 2011-08-24 08:08:14

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

Thescratch3 wrote:

4lover wrote:

here it is in terms of blocks;<forever><go to x sad  the position of the character )y sad  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


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

#14 2011-08-24 19:03:04

Gemini8910
Scratcher
Registered: 2011-08-23
Posts: 24

Re: Real Time Fighting for Action Adventure?

OK I think I have a working script using the mouse. Just have to work out a few kinks and I'll be good.  smile  Until I have another question of course. XD  tongue

Offline

 

#15 2011-08-24 19:36:00

4lover
Scratcher
Registered: 2010-04-24
Posts: 500+

Re: Real Time Fighting for Action Adventure?

ok XD


Check out this awesome new zombie-cod type of game: http://scratch.mit.edu/projects/4lover/1975649

Offline

 

Board footer