Type Player As Integer XPos As Integer YPos As ANY PTR PUp As ANY PTR PDown As ANY PTR PRight As ANY PTR PLeft As ANY PTR DeadSign As ANY PTR Pickaxe As ANY PTR TNTPlaced As Integer AnimTimer As Integer Seite As Byte MoveLock As Byte Dead As Byte GotPickaxe As Byte GotTNT As Byte SCrollstone As Byte PTR World Dim as GUI GDead Declare Constructor(X as Integer, Y as Integer) Declare Sub G() Declare Sub Control() Declare Sub SetWorld(World() as Byte) End Type Constructor Player(X as Integer, Y as Integer) XPos = X YPos = Y PUp = LoadImgFile("res\player\pup.bmp") PDown = LoadImgFile("res\player\pdown.bmp") PRight = LoadImgFile("res\player\pright.bmp") PLeft = LoadImgFile("res\player\pleft.bmp") DeadSign = LoadImgFile("res\menu\veryweak.bmp") Pickaxe = LoadImgFile("res\map\pickaxe.bmp") TNTPlaced = LoadImgFile("res\map\tntplaced.bmp") GDead.NewButton(512 - 96, 384 - 24, "res\menu\okup.bmp", "res\menu\okdown.bmp", "respawn", @Ev) End Constructor Sub Player.G() If Dead = 0 then If AnimTimer > 0 then If Seite = 0 then Put(7 * 64, 5 * 64), PDown, ALPHA, 255 If Seite = 1 then Put(7 * 64, 5 * 64), PUp, ALPHA, 255 If Seite = 2 then Put(7 * 64, 5 * 64), PRight, ALPHA, 255 If Seite = 3 then Put(7 * 64, 5 * 64), PLeft, ALPHA, 255 Else Put(7 * 64, 5 * 64), PDown, ALPHA, 255 Endif If GotPickaxe = 1 then Put(130, 0) , Pickaxe , ALPHA, 255 If GotTNT = 1 then Put(140 + 64, 0), TNTPlaced, ALPHA, 255 Else Put(512 - 125, 384 - 125), DeadSign, ALPHA, 255 GDead.G() Endif End Sub Sub Player.Control() Dim as Integer OldPosX, OldPosY If Dead = 0 then OldPosX = XPos OldPosY = YPos AnimTimer -= 1 If MoveLock = 0 then MoveLock = 1 Dim as Byte Direction If Multikey(&h11) then Direction = 1 'W If Multikey(&h48) then Direction = 1 'UP If Multikey(&h1F) then Direction = 2 'S If Multikey(&h50) then Direction = 2 'DOWN If Multikey(&h1E) then Direction = 3 'A If Multikey(&h4B) then Direction = 3 'LEFT If Multikey(&h20) then Direction = 4 'D If Multikey(&h4D) then Direction = 4 'RIGHT If Multikey(&h1C) then Dead = 1 If Direction = 1 then YPos -= 1 : AnimTimer = 5 : Seite = 1 'W If Direction = 2 then YPos += 1 : AnimTimer = 5 : Seite = 0 'S If Direction = 3 then 'A XPos -= 1 AnimTimer = 5 Seite = 3 If World[((XPos) * 64) + YPos] = 2 And World[((XPos - 1) * 64) + YPos] = 1 then World[((XPos - 1) * 64) + YPos] = 2 World[((XPos) * 64) + YPos] = 1 If Sound = 1 then TiPlaySample("rollstone" & STR(SCrollstone)) SCrollstone += 1 If SCrollstone > 4 then SCrollstone = 0 Endif Endif If Direction = 4 then 'D XPos += 1 AnimTimer = 5 Seite = 2 If World[((XPos) * 64) + YPos] = 2 And World[((XPos + 1) * 64) + YPos] = 1 then World[((XPos + 1) * 64) + YPos] = 2 World[((XPos) * 64) + YPos] = 1 If Sound = 1 then TiPlaySample("rollstone" & STR(SCrollstone)) SCrollstone += 1 If SCrollstone > 4 then SCrollstone = 0 Endif Endif Endif If XPos < 0 then XPos = 0 If YPos < 0 then YPos = 0 If XPos > 63 then XPos = 63 If YPos > 63 then YPos = 63 If World[64 * XPos + YPos] = 2 Or _ World[64 * XPos + YPos] = 6 then XPos = OldPosX YPos = OldPosY Endif If World[64 * XPos + YPos] = 7 And GotPickaxe = 1 then ElseIf World[64 * XPos + YPos] = 7 then XPos = OldPosX YPos = OldPosY Endif If NOT Multikey(&h11) And NOT Multikey(&h1F)_ And NOT Multikey(&h1E) And NOT Multikey(&h20)_ And NOT Multikey(&h48) And NOT Multikey(&h50)_ And NOT Multikey(&h4B) And NOT Multikey(&h4D) then MoveLock = 0 Else GDead.Control() Endif End Sub Sub Player.SetWorld(World() as Byte) This.World = @World(0, 0) End Sub