I'm still having a lot of trouble with a fighting element in part of my game. I'm wondering how do I make it so that HENRY can do a right punch if that frame (h\frame) for punching is 7 (with h\frame 6 being the frame in which HENRY faces the right). Also, I wanted my HENRY character to punch in the Left direction if the frame (h\frame) for that is 9 (with h\frame 8 being the frame in which Henry faces the left before and after punching).
Below, there's a line with notes at the section that I want to fix at Key (25). It's so that the part that I need help with can be easier to find.
Thanks
Graphics 1640, 1000
SetBuffer BackBuffer()
GameTimer = CreateTimer(60)
Global HENRYIMAGE = LoadAnimImage ("HenryMoveAroundIII.PNG",400,370,0,14)
Type HENRY
Field x,y
Field frame
Field image
Field Time
End Type
Global h.HENRY = New HENRY
h\x = 500
h\y = 430
h\image = HENRYIMAGE
While Not KeyDown(1)
Cls
WaitTimer (GameTimer)
HenryCharacteristics()
Flip
Wend
Function HenryCharacteristics()
DrawImage (h\image,h\x,h\y,h\frame)
If KeyDown (203) Then
If h\Time<MilliSecs()
h\x = h\x - 6
h\frame = h\frame + 1
If h\frame > 5 Then ;Frame 5 and 4 are used for walking to the left
h\frame = 4
EndIf
If h\frame < 4 Then
h\frame = 4
EndIf
h\Time=MilliSecs()+100
EndIf
EndIf
If KeyDown (205) Then
If h\Time<MilliSecs()
h\x = h\x + 6
h\frame = h\frame +1
If h\frame > 2 Then ;Frames 2 and 1 are used for walking to the right
h\frame = 1
EndIf
If h\frame < 1 Then
h\frame = 1
EndIf
h\Time=MilliSecs()+100
EndIf
EndIf
If KeyHit(25);---------------------- Here's the part I need help with----------------------------------------------------
;how do I make it so that HENRY can do a right punch using Key (25), if that frame (h\frame) for punching is 7 (with
;h\frame 6 being the frame in which HENRY faces the right). Also with Key (25), I wanted my HENRY character
;To punch in the Left direction if the frame (h\frame) for that is 9 (with h\frame 8 being the frame
;in which Henry faces the left before and after punching.
;I'm basically trying to make something like the old NES game Kung Fu, Bad Dudes, etc. But I'm having trouble doing it.
EndIf
;-----------------this is all I need help with for now---------------------
End Function
Last edited 2011
|