Variablen zu viel und zu wenig
Übersicht

![]() |
JackBetreff: Variablen zu viel und zu wenig |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi, ich habe ein sehr großes Problem. Ich will ein RPG programmieren, doch mein Code spinnt total:
Code: [AUSKLAPPEN] AppTitle "The Legend of Lador"
Graphics 640,480,16,1 Global font = LoadFont("Comic Sans MS",20,0,0,0) SetFont font SetBuffer BackBuffer() Global ppx = 1*16 Global ppy = 1*16 Global px = 1 Global py = 1 Global scrollx = -19*16 Global scrolly = -13*16 Global frame = 0 Global aa Global xo Global shot = 1 Global char = LoadAnimImage("grafik/lador.png",16,16,0,4) MaskImage char, 255,255,255 Global tileset = LoadAnimImage("grafik/tileset.png",16,16,0,11) Global sound = LoadSound("sound/sound.mp3") LoopSound sound PlaySound sound Dim map(19,19) Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,2 Data 2,0,0,0,0,0,0,2,3,3,3,4,0,0,0,1,6,1,0,2 Data 2,0,0,0,0,0,0,5,0,0,0,7,0,0,0,1,1,1,0,2 Data 2,0,0,0,0,0,0,5,0,0,0,7,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,5,0,0,0,7,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,8,9,0,9,10,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2 Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 For y = 0 To 19 For x = 0 To 19 Read map(x,y) Next Next Repeat Cls If KeyDown(1) Then Exit If KeyDown(63) Then SaveGame "Speicher\" + Name$ + ".txt" EndIf If KeyDown(67) Then LoadGame "Speicher\" + Name$ + ".txt" EndIf For x = 0 To 19 For y = 0 To 19 DrawBlock tileset,x*16-scrollx,y*16-scrolly,map(x,y) Next Next DrawImage char,ppx-scrollx,ppy-scrolly,frame Text 0,0,px Text 0,20,py If move = 1 Then If aa > 0 scrolly = scrolly + 1 ppy = ppy + 1 xo = xo + 1 If xo = 16 Then aa = 0:py = py + 1:xo = 0 End If End If If move = 2 Then If aa > 0 scrolly = scrolly - 1 ppy = ppy - 1 xo = xo + 1 If xo = 16 Then aa = 0:py = py - 1:xo = 0 End If End If If move = 3 Then If aa > 0 scrollx = scrollx - 1 ppx = ppx - 1 xo = xo + 1 If xo = 16 Then aa = 0:px = px - 1:xo = 0 End If End If If move = 4 Then If aa > 0 scrollx = scrollx + 1 ppx = ppx + 1 xo = xo + 1 If xo = 16 Then aa = 0:px = px + 1:xo = 0 End If End If If KeyDown(205) Then If map(px+1,py) < 2 Then If aa < 2 Then move = 4 aa = 2 frame = 1 End If End If End If If KeyDown(203) Then If map(px-1,py) < 2 Then If aa < 2 Then move = 3 aa = 2 frame = 2 End If End If End If If KeyDown(200) Then If map(px,py-1) < 2 Then If aa < 2 Then move = 2 aa = 1 frame = 3 End If End If End If If KeyDown(208) Then If map(px,py+1) < 2 Then If aa < 2 Then move = 1 aa = 2 frame = 0 End If End If End If If KeyHit(88) Then SaveBuffer(FrontBuffer(),"Shot" + Str$(shot) + ".bmp") shot = shot + 1 EndIf Flip Forever FreeImage tileset FreeImage char End Function SaveGame(Datei$) Datei = WriteFile(Datei$) If Datei = 0 Then Return 0 WriteInt Datei, ppx WriteInt Datei, ppy WriteInt Datei, px WriteInt Datei, py WriteInt Datei, scrollx WriteInt Datei, scrolly WriteInt Datei, aa WriteInt Datei, xo WriteInt Datei, frame CloseFile Datei Return 1 End Function Function LoadGame(Datei$) Datei = ReadFile(Datei$) If Datei = 0 Then Return 0 ppx = ReadInt(Datei) ppy = ReadInt(Datei) px = ReadInt(Datei) py = ReadInt(Datei) scrollx = ReadInt(Datei) scrolly = ReadInt(Datei) aa = ReadInt(Datei) xo = ReadInt(Datei) frame = ReadInt(Datei) CloseFile Datei Return 1 End Function Warum ist ppy manchmal zu wenig? Ich habe doch alles richtig gemacht! Oh ja, ich will es schaffen, dass meine Figur auch auf anderem Gras laufen kann, sonst wäre mein Spiel ja langweilig! Bitte lest euch den Code doch mal durch und postet dann! Danke |
||
Wer kein HTML kann und lernen will, der ist wirklich dumm... MFG Dennerlein |
![]() |
Artemis |
![]() Antworten mit Zitat ![]() |
---|---|---|
Bitte formatiere den Code ordentlich, sonst lesen wir ihn nicht durch. | ||
![]() |
Goodjee |
![]() Antworten mit Zitat ![]() |
---|---|---|
es gibt auch eine function BB-Code
Seiht dan wie fogt aus: BlitzBasic: [AUSKLAPPEN] Print \"Hallo\" |
||
"Ideen sind keine Coladosen, man kann sie nicht recyclen"-Dr. House
http://deeebian.redio.de/ http://goodjee.redio.de/ |
![]() |
Hubsi |
![]() Antworten mit Zitat ![]() |
---|---|---|
Oh nö ![]() ![]() Das Problem an sich liese sich viel leichter lösen wenn Du den Code samt Bildern, etc. zusammenpackst und hochlädst ![]() ![]() |
||
Den ganzen Doag im Bett umanandflagga und iaz daherkema und meine Hendl`n fressn... |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group