Variablen zu viel und zu wenig

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Jack

Betreff: Variablen zu viel und zu wenig

BeitragSa, Dez 10, 2005 15:13
Antworten mit Zitat
Benutzer-Profile anzeigen
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

BeitragSa, Dez 10, 2005 17:51
Antworten mit Zitat
Benutzer-Profile anzeigen
Bitte formatiere den Code ordentlich, sonst lesen wir ihn nicht durch.

Goodjee

BeitragSa, Dez 10, 2005 18:52
Antworten mit Zitat
Benutzer-Profile anzeigen
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

BeitragSa, Dez 10, 2005 19:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Oh nö Very Happy Bei so ellenlangen Codes rechnet sich der Server immer halb tot bis ers anzeigen kann mit den syntax-Tags Very Happy

Das Problem an sich liese sich viel leichter lösen wenn Du den Code samt Bildern, etc. zusammenpackst und hochlädst Very Happy Dank fehlender Fromatierung ist es so schon schwer genug Wink
Den ganzen Doag im Bett umanandflagga und iaz daherkema und meine Hendl`n fressn...

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group