CREEPER 2 von ???
Hi.

wollte auch ma was ins Code-Archiv spammen.
ich hab das vor langer langer zeit ma gecodet. man spielt mit 2 bis 4 spielern und muss eine linie durch die gegend schlängeln ohne etwas dabei zu berühren, wer als erstes etwas berührt hat, hat verloren.

[code:1:267e1bc516]
;##################################### CREEPER 2 ######################################

;init
Const w = 800,h = 600
AppTitle "zWisChE pReSeNtS cReEpEr 2"
Graphics w,h,0,2
SetBuffer BackBuffer()
HidePointer
timer = CreateTimer(40)
font = LoadFont("Arial",70,1,0,0) : SetFont font

;level
lvl = 1
lvlimg = LoadImage("lvl"+Str(lvl)+".png")

;spieler
Type player
Field name$
Field x,y
Field dir
Field r,g,b
Field key0,key1,key2,key3
End Type
CreatePlayers(2)

;##################################### MAINLOOP ######################################

Repeat

;level zeichnen
If lvlimg <> 0 Then TileImage lvlimg

;alle spieler berechnen/zeichnen
For p.player = Each player
;richtung ändern
If KeyHit(pkey0) And pdir <> 2 Then pdir = 0
If KeyHit(pkey1) And pdir <> 3 Then pdir = 1
If KeyHit(pkey2) And pdir <> 0 Then pdir = 2
If KeyHit(pkey3) And pdir <> 1 Then pdir = 3
;bewegen
If pdir = 0 Then py = py-1
If pdir = 1 Then px = px+1
If pdir = 2 Then py = py+1
If pdir = 3 Then px = px-1
;screenseite wechseln
If px >= w Then px = 0
If px < 0 Then px = w
If py >= h Then py = 0
If py < 0 Then py = h
;kolli checken
If px >= 0 And px < w And py >= 0 And py < h Then
GetColor px,py
If ColorRed() <> 0 Or ColorGreen() <> 0 Or ColorBlue() <> 0 Then
;verloren
Color 255,255,255 : Print p
ame+" hat verloren!" : Print "" : Print "rofl... O_o" : Print "" : Print "Esc zum beenden"
Repeat : Until KeyHit(1) : End
EndIf
EndIf
;zeichnen
Color p
,pg,p
Plot px,py
Next

WaitTimer(timer)
Flip
Until KeyHit(1)
End

;##################################### FUNCTIONS ######################################

Function CreatePlayers(anz)
For i = 1 To anz
p.player = New player
Select i
Case 1
p
ame = "Rot"
px = 10 : py = 10 : pdir = 2
p
= 255
pkey0 = 200 : pkey1 = 205 : pkey2 = 208 : pkey3 = 203
Case 2
p
ame = "Blau"
px = w-10 : py = 10 : pdir = 2
p = 255
pkey0 = 17 : pkey1 = 32 : pkey2 = 31 : pkey3 = 30
Case 3
p
ame = "Grün"
px = 10 : py = h-10
pg = 255
pkey0 = 76 : pkey1 = 81 : pkey2 = 80 : pkey3 = 79
Case 4
p
ame = "Gelb"
px = w-10 : py = h-10
p
= 255 : pg = 255
pkey0 = 22 : pkey1 = 37 : pkey2 = 36 : pkey3 = 35
Default
Delete p.player
End Select
Next
End Function
[/code:1:267e1bc516]

achja, man kann auch level selber zeichnen, einfach ein png bild mit namen lvl0.png, lvl1.png, usw in dem ordner erstellen.
viel spass :D



Suche:
(unterstützt mySQL Wildcards ala %)
Titel:
Text:
Autor: