The code is pretty simple, its just that I cannot exit out of my program without using ctrl + alt + delete everytime
'MEGA MAN REMAKE
Graphics 800,600
'AppTitle = "MegaMan [{Gam3rs Unit3}: ZaChO]"
AutoMidHandle(True)
Const Gravity:Float = 0.2
Global Jump:Int = 1
Global JumpHeight:Float = 3.7
Global CanJump:Int = 1
Global Falling:Int = 0
Type MegaMan 'idle
Field x,y
Field frame
EndType
SetMaskColor(0,128,128)
'LOAD IMAGES
Global megaIdle:TImage=LoadAnimImage("C:/Users/Zachary/Pictures/Mega Man/megaIdle.bmp",30,36,0,3)
Global megaJump:TImage=LoadImage("C:/Users/Zachary/Pictures/Mega Man/megaJump.bmp")
Global megaRR:TImage=LoadAnimImage("C:/Users/Zachary/Pictures/Mega Man/megaRR.bmp",30,36,0,3)
Global megaRL:TImage=LoadAnimImage("C:/Users/Zachary/Pictures/Mega Man/megaRL.bmp",30,36,0,3)
Global player:MegaMan = New MegaMan 'idle
player.x = 400
player.y = 500
player.frame = 0
While Not KeyHit(ESC) Or AppTerminate()
Cls
Movement ()
Draw ()
DoJump ()
Flip
Wend
Function Draw ()
If Jump = 1
DrawImage megaJump:TImage,player.x,player.y,player.frame
ElseIf Jump = 0 And MR = 0 And ML = 0
DrawImage megaIdle:TImage,player.x,player.y,player.frame
ElseIf Jump = 0 And MR = 1
DrawImage megaRR:TImage,player.x,player.y,player.frame
ElseIf Jump = 0 And ML = 1
DrawImage megaRL:TImage,player.x,player.y,player.frame
EndIf
EndFunction
Function DoJump ()
If KeyHit(KEY_SPACE)
Jump = 1
CanJump = 0
End If
If Jump = 1
player.y:-JumpHeight
JumpHeight:-Gravity
If JumpHeight <= - 1.0
Falling = 1
EndIf
End If
If Falling = 1
player.y:+3.2
If player.y >= 500
Jump = 0
Falling = 0
CanJump = 1
JumpHeight = 3.7
EndIf
EndIf
End Function
Function Movement ()
If KeyDown (KEY_RIGHT)
MR = 1
player.x:+3
EndIf
If KeyDown (KEY_LEFT)
ML = 1
player.x:-3
EndIf
MR = 0
ML = 0
EndFunction
|