Code: Select all
Text 0,0,"Hello, press enter to start"
DrawScreen
WaitKey
Type AMMUS
Field obj
End Type
FrameLimit 40
DrawToWorld ON
kartta = LoadMap("Media\cdm2.til","Media\tileset.bmp")
PlayObject kartta, 0,0,1
ukko = LoadObject("Media\soldier.bmp",72)
pati=LoadObject("Media\bullet.bmp")
ShowObject pati,OFF
SetupCollision ukko, kartta, 1, 4, 2
Repeat
If LeftKey() Then TurnObject ukko,5
If RightKey() Then TurnObject ukko,-5
If UpKey() Then MoveObject ukko,2
If DownKey() Then MoveObject ukko,-2
If KeyDown(cbKeyRControl) And reload=0 Then
luoti.AMMUS = New(AMMUS)
luoti\obj=CloneObject(pati)
CloneObjectPosition luoti\obj,ukko
CloneObjectOrientation luoti\obj,ukko
SetupCollision luoti\obj, kartta, 2,4,1
reload=5
ResetObjectCollision luoti\obj
EndIf
If reload>0 Then reload=reload-1
For luoti.AMMUS = Each AMMUS
MoveObject luoti\obj,6
If CountCollisions (luoti\obj) Or Distance2 (luoti\obj, ukko) > 1000 Then
DeleteObject luoti\obj
Delete luoti
EndIf
Next luoti
UpdateGame
CloneCameraPosition ukko
DrawGame
ObjectPick ukko
e=PickedObject()
DrawGame
If e=kartta Then
Color cbGreen
Circle PickedX()-4,PickedY()+4,8,OFF
EndIf
DrawScreen
Forever
Ps, en käytä copy paste menetelmää, koska olisi kiva oppia jotakin