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

#1 2011-12-30 11:55:42

xGluttony
Scratcher
Registered: 2011-05-03
Posts: 25

I need help in fighting script

I want to make a 2d RPG game that contains fighting monsters.

This is what i need help in :
I want player to attack, and it must go near to the monster to attack it like games like a arcade fighter games.

Thanks in advance


http://i55.tinypic.com/2mcx6x5_th.jpg

Offline

 

#2 2011-12-31 16:05:19

Medic
Scratcher
Registered: 2011-09-10
Posts: 1000+

Re: I need help in fighting script

[when <arrow key> pressed]
[wait until touching <monster>
[switch to costume <attack>]

I hope this helped.  smile


http://i43.tinypic.com/zm1pie.png

Offline

 

#3 2011-12-31 19:47:41

luiysia
Scratcher
Registered: 2011-07-05
Posts: 1000+

Re: I need help in fighting script

Medic wrote:

[when <arrow key> pressed]
[wait until touching <monster>
[switch to costume <attack>]

I hope this helped.  smile

I think a better one would be:

[when arrow key pressed] or [when [attack]recieved] (like with a broadcast)
[glide (x) seconds to (x position of monster) (y position of monster)]
[switch to costume <attack>]
[change <monster health> by (- attack power)]
[glide (x) seconds to (previous x position) (previous y position)]


http://i50.tinypic.com/dx00pd.gif

Offline

 

#4 2012-01-01 23:29:02

MaxFlyboy
Scratcher
Registered: 2011-11-07
Posts: 100+

Re: I need help in fighting script

Well if you have an attacking person you could do this

when green flag clicked
set attacking(a variable) to 0
forever start
if (attack button) pressed
set attacking to 1
(optional animation sequence)
switch to costume slash1
wait 0.05 sec
switch to costume slash2
wait 0.05 sec
switch to costume slash3
(end of animation sequence)
set attacking to 0
forever end

put that script under the person who attacks


for the monster you could do this

when green flag clicked
forever start
if touching color (the color of the tip of the blade) and attacking = 1
change health (his health variable) by attack damage (damage variable)
wait 0.3 seconds
forever end

note the health variable should be just for the monster sprite, not for every sprite. while the attacking and the damage and attacking variable should be for every sprite.

this is for if your walking around on a 2d game, non isometric, and you walk on a platform. It only works if he actually turns left and right. not just moves.

http://www.oneflashgameaday.com/games/scr/armor-mayhem.jpg
this is an example of where it would work on.

let's say they couldn't shoot and could only hit each other with their guns. The guy on the left (assuming you have movement) would move towards the guy on the right. when you press the attack button he puts his hand up and very quickly slashes it down (that would be the animation sequence) and that would deal damage


hope this helps


http://cdn.voodoofilm.org/images/upload/thumb/viral-video-2011.jpg click the picture for an AMV

Offline

 

Board footer