Anyone who can help me to create a simple fighting-system that allow you to kick or punch the other player, and the player that being hit will be pushed back. I have tried to do it self with to create different hot spot, but the problem is that my game is so undynamic, and really static
![](/images/smilies/happy.gif)
if someone could help me with to create or come with examples that would be nice.
Here is my game code
Rem Project: 2D project
Rem Created: Sunday, October 06, 2013
Rem ***** Main Source File *****
#constant bg 6
#constant bg2 23
#constant platform 2
#constant BGscore 3
#constant Wood 54
#constant wood2 55
#constant Invisible_Wall 13
#constant Hotspot1 44
#constant Hotspot2 45
#constant m1 77
#constant m2 78
#constant m3 79
#constant m4 80
Rem *********PLAYER********
#constant _TRUE = 1
#constant _FALSE = 0
#constant _JUMPSPEED 4
#constant _JUMPPOWER 15
x# = 50
y# = 685
speed# = 4
health=100
Rem *********PLAYER_ENEMY************
#constant _TRUE2 = 1
#constant _FALSE2 = 0
#constant _JUMPSPEED2 4
#constant _JUMPPOWER2 15
#constant enemy 7
E# = 50*17
Y2# = 672
speed2# = 4
Health2=10000
Rem *********PLAYER_ENEMY_FLY************
ii = 0
START3 = 0
Rem *********DISPLAY*********
AUTOCAM OFF
BACKDROP ON
COLOR BACKDROP 0
SYNC
SYNC RATE 60
SYNC ON
SET DISPLAY MODE 1024, 768, 32,
Rem *********LOAD_IMAGE**********
Load image "sprites\TRYMS\industri11.jpg", bg
Load image "sprites\TRYMS\industri1.jpg", 223
Load image "sprites\TRYMS\industri22.jpg", bg2
Load image "sprites\TRYMS\industri.jpg", 222
Load image "sprites\TRYMS\in.jpg", 224
Load image "sprites\TRYMS\platform.png", platform
Load image "sprites\TRYMS\SCORE.png", BGscore
Load image "sprites\TRYMS\wood2.png", Wood
Load image "Sprites\TRYMS\wood3.png", wood2
Load image "Sprites\TRYMS\Invisiblewall.png", Invisible_wall
Load image "Sprites\TRYMS\Hotspothead.png", Hotspot1
Load image "Sprites\TRYMS\chest.png", Hotspot2
Rem *********MUSIC***************
Load music "Music\Killer instinct.mp3",m1
Load music "Music\Charlie_Bravo.mp3",m2
Load music "Music\Derailer.mp3",m3
Load music "Music\All Your Base.mp3",m4
Rem **************SFX*****************
Load sound "SFX\test.wav",99
Rem *********ENEMY_SPRITE***********
create animated sprite 7, "sprites\TRYMS\sprite2.png", 1,1,7
sprite 7, 32*30, 672, 7
mirror sprite 7
show sprite 7
Rem *********RANDOMBOX_SPRITE***********
create animated sprite 10, "sprites\TRYMS\Randombox.png",1,1,10
sprite 10,32*77, 448,10
show sprite 10
Rem **********COIN_SPRITE***********
create animated sprite 8, "sprites\TRYMS\coin.png",1,1,8
sprite 8,32*77, 448,8
show sprite 8
create animated sprite 9, "sprites\TRYMS\coin.png",1,1,9
sprite 9,32*77, 448,9
show sprite 9
Rem ************INVISBLE_WALL***********
Sprite 13,-10,y,13
Sprite 14,1024,y,13
XK = 0
XJ = 512
KK = 0
XH = 512
START = 0
START2 = 0
Rem ***********HEALTH_HEART*************
create animated sprite 66,"sprites\TRYMS\Heart2.0.png",5,3,66
sprite 66,0,-50,66
delay=150
Rem ***********HEALTH_HEART*************
create animated sprite 67,"sprites\TRYMS\Heart2.0.png",5,3,67
sprite 67,630,-50,67
delay=150
Rem ***********ANIMATED_SPRITE**********
create animated sprite 1,"sprites\TRYMS\test.bmp",5,1,1 rem we divide our bmp in five frames
sprite 1,x,690,1
delay=150
x=100
y=200
state=0
Badass= 1
BAM= 0 :rem badass mode flag
coolDown= 0 :rem badass cooldown timer
Rem ********PASTE_IMAGE/MUSIC*********
DO
Play music m1
Stop music m1
Paste image bg,0,0
Paste image bg2,512,0
for i=0 to 32
Paste image 2,32*i,736,1
next i
Rem ***********PLAYER_ANIMATION**********
if leftkey()=1
x=x-1
if state<>3 then state=3 : set sprite frame 1,2
play sprite 1,2,6,80
else
if rightkey()=1
x=x+1
if state<>4 then state=4 : set sprite frame 1,2
play sprite 1,2,6,80
endif
endif
Rem *******BACKGROUND_MOVEMENT*********
If sprite collision(1,14)then START = 1
If START = 1
Paste image 223,XK,0
Paste image 222,512,0
dec XK, 1
endif
if XK < -512
for i=0 to -512 step -1
Paste image 224,XJ,0
next i
XJ = 0
endif
If XJ = 0 then START = 1
If sprite collision(7,13)then START2 = 1
If START2 = 1
Paste image 223,KK,0
Paste image 224,0,0
inc KK, 1
endif
if KK > 512
for i=0 to 0 step 1
Paste image 222,XH,0
next i
XH = 512
endif
If XH = 0 then START2 = 1
Paste image Wood,-50,-40,1
Paste image Wood2,50,-40,1
Paste image 3,3,20,1
Paste image 3,920,20,1
for i=0 to 32
Paste image 2,32*i,736,1
next i
Rem ********SCORE********
Ink rgb(255,0,0),rgb(0,0,0)
Set text font "arial"
Set text size 50
Text 958,47,str$(score2)
Ink rgb(255,0,0),rgb(0,0,0)
Set text font "arial"
Set text size 50
Text 40,47,str$(score)
if sprite hit(1,8)=1 then inc score, 1
if sprite hit(7,8)=1 then inc score, 1
if sprite collision(1,8)then sprite 8,600,600,8
if sprite collision(7,8)then sprite 8,600,600,8
if sprite hit(1,9)=1 then inc score, 1
if sprite hit(7,9)=1 then inc score2, 1
if sprite collision(1,9)then sprite 9,600,600,9
if sprite collision(7,9)then sprite 9,600,600,9
Rem ************HOTSPOTS*****************
h1x = sprite x (1)
h1y = sprite y (1)
sprite 44,h1x+20,h1y-40,44
h2x = sprite x (7)
h2y = sprite y (7)
sprite 45,h2x+20,h2y-7,44
h1x = sprite x (1)
h1y = sprite y (1)
sprite 46,h1x+20,h1y+10,45
h2x = sprite x (7)
h2y = sprite y (7)
sprite 47,h2x+20,h2y+20,45
Hide sprite 44
Hide sprite 45
Hide sprite 46
Hide sprite 47
Rem **************FIGHTING***************
if keystate(18)=1 and sprite collision (1,7)
dec health2, 1
play sound 99
endif
if keystate(18)=1 and sprite collision (1,45)
dec health2, 2
inc score,4
play sound 99
endif
if keystate(16)=1 and sprite collision (7,44)
dec health1, 2
inc score2,4
play sound 99
endif
if keystate(16)=1 and sprite collision (7,1)
dec health, 1
play sound 99
endif
Rem *************HEART2******************
if health2>75
Play sprite 67,1,13,100
endif
if health2<=75
Play sprite 67,1,13,75
endif
if health2<=50
Play sprite 67,1,13,50
endif
if health2<=25
Play sprite 67,1,13,25
endif
if health2<=10
Play sprite 67,1,13,10
endif
if health2<=5
Play sprite 67,1,13,2
endif
Rem ********HEAR1***********
if health>75
Play sprite 66,1,13,100
endif
if health<=75
Play sprite 66,1,13,75
endif
if health<=50
Play sprite 66,1,13,50
endif
if health<=25
Play sprite 66,1,13,25
endif
if health<=10
Play sprite 66,1,13,10
endif
if health<=5
Play sprite 66,1,13,2
endif
if health2 = 0
sleep 3000
end
if health = 0
sleep 3000
end
endif
endif
Rem *********COMBO_BADASS***********
if spacekey()=1 then inc state2,1
if spacekey()=1 then text 350,47,"SPACE"
if spacekey()=0 then state2=0
if keystate(19)=1 then inc state2,1
if keystate(19)=1 then text 510,47,"+ R"
if keystate(19)=0 then state2=0
if keystate(20)=1 then inc state2,1
if keystate(20)=1 then text 590,47,"+ T"
if keystate(20)=0 then state2=0
if state2>3
Seconds=3:
T=Timer()
Repeat
Elapsed=(Timer()-T)/1000
TimeLeft=Seconds-Elapsed
IK blur image 6, 3, 2
IK gradient Radial 6, x, y, 10,10,50,200 ,5 ,2
IK Modify Image Saturation 6, 1000.0
IK blur image 23, 3, 2
IK gradient Radial 23, x, y, 10,10,50,200 ,5 ,2
IK Modify Image Saturation 23, 1000.0
Until TimeLeft<=0
endif
if BAM = 1
scale sprite 1,500
x# = x# + (rightkey()-leftkey())*speed#
sprite 1,x#,y3#,1
if upkey() then _Jump = _TRUE
if _Jump = _TRUE
inc jump#,_JUMPSPEED2
y3# = y3#-_JUMPPOWER2*cos(jump#)
if jump# = 180
y3# = 480
jump# = 0
_Jump = _FALSE
ENDIF
ENDIF
ENDIF
Text 350,47,(msg$)
if state2>3 and coolDown <=0
BAM = 1
msg$= "BADASS MODE!"
coolDown = 1 :rem doesn't actually matter what value this is as long as it's positive.
BAMt= timer()
endif
if BAM = 0 then scale sprite 1, 100
if coolDown >0
coolDown= 20000 - (timer() - BAMt)
if coolDown <10000
BAM= 0
msg$= "COOLDOWN "+str$(cooldown/100)+""
endif
else
msg$= ""
endif
SYNC
Rem ********JUMP_ENEMY*********
E# = E# + (keystate(32)-keystate(30))*speed2#
sprite 7,E#,Y2#,7
if keystate(17) then _Jump2 = _TRUE2
if _Jump2 = _TRUE2
inc jump2#,_JUMPSPEED
Y2# = Y2#-_JUMPPOWER*cos(jump2#)
if jump2# = 180
Y2# = 672
jump2# = 0
_Jump2 = _FALSE2
ENDIF
ENDIF
Rem *********JUMP_PLAYER*********
if Bam = 0
x# = x# + (rightkey()-leftkey())*speed#
sprite 1,x#,y#,1
if upkey() then _Jump = _TRUE
if _Jump = _TRUE
inc jump#,_JUMPSPEED2
y# = y#-_JUMPPOWER2*cos(jump#)
if jump# = 180
y# = 685
jump# = 0
_Jump = _FALSE
ENDIF
ENDIF
ENDIF
Rem ******************************
LOOP
Thanks for help