Post by smc44 on Nov 23, 2008 12:46:00 GMT -5
hi im wondering if there were was a function to disable all of the keys
like this
If Player.JetPackEnergy = 0 Then ScanKeyDown(FALSE)
EndIf
wat im trying to do is make it so if your energy is zero then you cannot use the jetpack anymore disbabling the key so you cannot pres it anymore, but i also want it enabled if your jetpack engery is 50, thanks for the help
here is wat i got so far (noobs i swear do not take this code)
like this
If Player.JetPackEnergy = 0 Then ScanKeyDown(FALSE)
EndIf
wat im trying to do is make it so if your energy is zero then you cannot use the jetpack anymore disbabling the key so you cannot pres it anymore, but i also want it enabled if your jetpack engery is 50, thanks for the help
here is wat i got so far (noobs i swear do not take this code)
'Wobbles World
'Created By Stephen Caples(Does most of the source), Kyle Lubman(Does most of the ideas)
'Player structure
Struc SPlayer
Dim Pos(1)
Dim Sprite
Dim Gravity
Dim JumpKey
Dim JetPackEnergy
EndStruc
Dim SPlayer Player
'Load the player texture and create a sprite
Player.Sprite = NewSprite(LoadTexture(""))
SprSetSize(32,32)
'Initial player posistions, or values
Player.JetPackEnergy = 100
Player.JumpKey = VK_SPACE
Player.Gravity = 5
Player.Pos(0) = 320
Player.Pos(1) = 400
TextMode(TEXT_BUFFERED)
'Main Loop
While TRUE:CLS
'Gravity takes effect
Player.Pos(1) = Player.Pos(1) + Player.Gravity
'Bind sprite to player posistions
BindSprite(Player.Sprite)
SprSetPos(Player.Pos(0), Player.Pos(1))
'Basic player movement
If ScanKeyDown(VK_LEFT) Then Player.Pos(0) = Player.Pos(0) - 3
EndIf
If ScanKeyDown(VK_RIGHT) Then Player.Pos(0) = Player.Pos(0) + 3
EndIf
If ScanKeyDown(Player.JumpKey) Then Player.Pos(1) = Player.Pos(1) - 4
Player.JetPackEnergy = Player.JetPackEnergy - 1
EndIf
If ScanKeyDown(Player.JumpKey) Then Player.Pos(1) = Player.Pos(1) - 4
EndIf
'Max Fuel
If Player.JetPackEnergy > 149 Then Player.JetPackEnergy = 149
EndIf
'Basic collision
If Player.Pos(1) > 400 Then Player.Pos(1) = 400
Player.JetPackEnergy = Player.JetPackEnergy + 1
EndIf
'Print player values
Printr "Fuel:"+Player.JetPackEnergy
'Draw sprites, text, and refresh the screen
DrawText()
'Ends the process if escape key is pressed
If ScanKeyDown(VK_ESCAPE) Then End
EndIf
'End of main loop
Wend
End