Moorhuhn klon

Übersicht BlitzBasic Allgemein

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen

 

Roggi

Betreff: doch wieder Problem

BeitragDi, Okt 25, 2005 21:34
Antworten mit Zitat
Benutzer-Profile anzeigen
Meine Stadt ist genau 800*600 aber doch sind die unteren centimeter nicht befahrbar. woran kann das liegen
 

Paranoide

BeitragDi, Okt 25, 2005 23:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Folgende Zeile:

BlitzBasic: [AUSKLAPPEN]
If KeyDown(runter) And ys < 470 Then ys = ys + 1 


musst du etwas abändern. Je nach dem, wie groß dein Auto ist, muss du den Wert "470" vielleicht in "530" oder so abändern. Der Wert gibt ja in diesem Fall an, wie weit das Auto nach unten darf. Wenn es also die y-Koordinate 470 erreicht hat, dann wird die Folge der Bedingung nicht mehr ausgeführt (weil ys ja NICHT mehr kleiner als 470 ist).

MfG

Michel
 

Roggi

Betreff: Danke

BeitragMi, Okt 26, 2005 9:53
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke für den Tip. das hab ich auch schon gemacht. Kann mir vielleicht jemand helfen. Ich will dass das Auto so eine kleine GTA Steuerung bekommt. Also das ich nicht, wenn ich nach links drücke dann gleichnach links fährt sondern erst wenn dazu noch gas gegeben wird Laughing

Danke schon ma
 

Roggi

Betreff: Frage

BeitragMi, Okt 26, 2005 14:24
Antworten mit Zitat
Benutzer-Profile anzeigen
1.Kann mir jemand sagen, wenn die Map größer als 800*600 sein soll ob der da von alleine scrollt oder wie mach ich dass

2.Kann man das Auto langsamer als +1 oder -1 bewegen
 

gamble

BeitragMi, Okt 26, 2005 15:12
Antworten mit Zitat
Benutzer-Profile anzeigen
1. Nein, da scrollt nichts automatisch. Such mal nach "scrolling", da dürftest Du eine Menge finden.

2. Mit Floats.
 

Roggi

Betreff: Wie

BeitragMi, Okt 26, 2005 19:11
Antworten mit Zitat
Benutzer-Profile anzeigen
Ja ich weiß schon das ich mit Floats Kommazahlen machen kann, doch wie setz ich die in meinen Code bei der Bewegungsabfrage ein?
BlitzBasic: [AUSKLAPPEN]

Graphics 1024,768,16,2
SetBuffer BackBuffer()
start=LoadImage(\"Grafik\start.bmp\");Startbilschirm
DrawImage start,1,1
Delay 2500
Cls


SetFont(LoadFont(\"Comic Sans MS\",30,1))

Const game_pause = 1
Const game_menue = 2
Const game_haupt = 3
Const game_over = 4

Global game_zustand = game_menue

Repeat


Select game_zustand
Case game_menue
GameMenue()
Case game_haupt
GameHaupt()
Case game_pause
GamePause()
End Select


Until game_zustand = game_over
End





Function GameMenue()

Local temp_zustand = game_zustand

FlushMouse()
FlushKeys()

Repeat
ClsColor 25,60,135
Cls

Color 255,255,255
Text GraphicsWidth()/3,200,\"Spiel\"

Color 255,255,255
Text GraphicsWidth()/3,300,\"ENDE\"


If MouseHit(1)
If RectsOverlap(MouseX(),MouseY(),1,1,GraphicsWidth()/3,200,StringWidth(\"START\"),StringHeight(\"START\"))
game_zustand = game_haupt
ElseIf RectsOverlap(MouseX(),MouseY(),1,1,GraphicsWidth()/3,300,StringWidth(\"ENDE\"),StringHeight(\"ENDE\"))
game_zustand = game_over
EndIf
EndIf


If KeyHit(1)
End
EndIf

Flip
Until game_zustand<>temp_zustand

End Function





Function GameHaupt()
Graphics 800,600,32,1
links = 203
rechts = 205
runter = 208
hoch = 200
start2=LoadImage(\"Grafik\start2.bmp\")
DrawImage start2,1,1
WaitKey

SetBuffer BackBuffer()
AppTitle (\"Die Autofahrt-Tom 10.05\");das was im Task steht


Auto=LoadImage(\"Grafik\Auto1.bmp\");lädt auto und Stadt
spielbild = LoadImage(\"Grafik\Map.bmp\")
Post=LoadImage(\"Grafik\Post.bmp\")

xs = 300; Wo das Auto steht
ys = 450



Repeat
Cls

;------------------------- Bewegung des Spielers -----------------------
If KeyDown(hoch) And ys > -2 Then ys = ys - 1
If KeyDown(runter) And ys < 570 Then ys = ys + 1
If KeyDown(rechts) And xs < 770 Then xs = xs + 1
If KeyDown(links) And xs > -2 Then xs = xs - 1


TileBlock spielbild, 1, 1

DrawImage Auto, xs, ys
MaskImage Auto,255,255,255
Flip
Until KeyHit(1)
End




Local temp_zustand = game_zustand
Local x = GraphicsWidth()/2
Local y = GraphicsHeight()/2
Local h = 0

FlushKeys()
FlushMouse()

Repeat
ClsColor 200,200,200
Cls


If KeyHit(57)
game_zustand = game_pause
EndIf


If KeyHit(1)
game_zustand = game_menue
EndIf

Flip
Until game_zustand<>temp_zustand

End Function

Function GamePause()

Local temp_zustand = game_zustand

FlushKeys()
FlushMouse()

Repeat
ClsColor 255,0,0
Cls

Color 0,0,255
Text GraphicsWidth()/2,GraphicsHeight()/2,\"ICH BIN DIE PAUSE!!!\",1,1

If KeyHit(57)
game_zustand = game_haupt
EndIf

Flip
Until game_zustand<>temp_zustand

End Function

Mo

BeitragMi, Okt 26, 2005 20:04
Antworten mit Zitat
Benutzer-Profile anzeigen
Na hallo, dann mach doch mal ein # nach deinen ys und xs Variablen und setzt mal die Geschwindigkeit auf 0.5 oder sonst was....

Ich hab zwar nicht viel von deinem Thema hier mitbekommen aber es hat mir so den Anschein, als ob du jeden Befehl erbettelst... is nicht ganz ok!

Mo
500 Euro Studiengebühren... ich glaub ich zieh in den Wald!!!

Eine Floßfahrt die ist lustig... *sing* Wink
 

Roggi

Betreff: Und wieder

BeitragMi, Okt 26, 2005 20:18
Antworten mit Zitat
Benutzer-Profile anzeigen
Andere Frage: Hab das jetzt zum Rennspiel gemacht. Doch in meinen Code ist etwas so falsch das der pro Runde mehrere Hundert anstatt eine zählt:
BlitzBasic: [AUSKLAPPEN]
Graphics 1024,768,16,2 
SetBuffer BackBuffer()
start=LoadImage(\"Grafik\start.bmp\");Startbilschirm
DrawImage start,1,1
Delay 2500
Cls


SetFont(LoadFont(\"Comic Sans MS\",30,1))

Const game_pause = 1
Const game_menue = 2
Const game_haupt = 3
Const game_over = 4

Global game_zustand = game_menue


;Wichtig. Hauptschleife. Hier wird das ganze Spiel verwaltet.

Repeat


Select game_zustand
Case game_menue
GameMenue()
Case game_haupt
GameHaupt()
Case game_pause
GamePause()
End Select


Until game_zustand = game_over
End





Function GameMenue()

Local temp_zustand = game_zustand

FlushMouse()
FlushKeys()

Repeat
ClsColor 25,60,135
Cls

Color 255,255,255
Text GraphicsWidth()/4,100,\"Die Rennstrecke - Beta\"

Color 255,255,255
Text GraphicsWidth()/3,200,\"Spiel\"

Color 255,255,255
Text GraphicsWidth()/3,300,\"ENDE\"


If MouseHit(1)
If RectsOverlap(MouseX(),MouseY(),1,1,GraphicsWidth()/3,200,StringWidth(\"START\"),StringHeight(\"START\"))
game_zustand = game_haupt
ElseIf RectsOverlap(MouseX(),MouseY(),1,1,GraphicsWidth()/3,300,StringWidth(\"ENDE\"),StringHeight(\"ENDE\"))
game_zustand = game_over
EndIf
EndIf


If KeyHit(1)
End
EndIf

Flip
Until game_zustand<>temp_zustand

End Function





Function GameHaupt()
Graphics 800,600,32,1
links = 203
rechts = 205
runter = 208
hoch = 200
start2=LoadImage(\"Grafik\start2.bmp\")
DrawImage start2,1,1
WaitKey

SetBuffer BackBuffer()
AppTitle (\"Die Autofahrt-Tom 10.05\");das was im Task steht


Auto=LoadImage(\"Grafik\Auto1.bmp\");lädt auto und Stadt
spielbild = LoadImage(\"Grafik\Map.bmp\")
ziel=LoadImage(\"Grafik\ziel.bmp\")
Runden =LoadImage(\"Grafik\Runden.bmp\")

xs# = 400; Wo das Auto steht
ys#= 450

xt#=480
yt#=400


Repeat
Cls

;------------------------- Bewegung des Spielers -----------------------
If KeyDown(hoch) And ys# > -2 Then ys# =ys#- 0.45
If KeyDown(runter) And ys# < 570 Then ys# =ys#+ 0.45
If KeyDown(rechts) And xs# < 770 Then xs#=xs#+ 0.45
If KeyDown(links) And xs# > -2 Then xs# =xs#- 0.45


TileBlock spielbild, 1, 1
DrawImage Ziel, xt, yt

DrawImage Auto, xs, ys
MaskImage Auto,255,255,255

DrawImage Runden, 500,20
MaskImage Runden,255,255,255
Text 530, 20, Str$(Rundenzahl)
If ImagesOverlap(Auto,xs,ys,ziel,xt,yt) Then
Rundenzahl = Rundenzahl + 1
EndIf
Flip




Until KeyHit(1)
End




Local temp_zustand = game_zustand
Local x = GraphicsWidth()/2
Local y = GraphicsHeight()/2
Local h = 0

FlushKeys()
FlushMouse()

Repeat
ClsColor 200,200,200
Cls


If KeyHit(57)
game_zustand = game_pause
EndIf


If KeyHit(1)
game_zustand = game_menue
EndIf

Flip
Until game_zustand<>temp_zustand

End Function

Function GamePause()

Local temp_zustand = game_zustand

FlushKeys()
FlushMouse()

Repeat
ClsColor 255,0,0
Cls

Color 0,0,255
Text GraphicsWidth()/2,GraphicsHeight()/2,\"ICH BIN DIE PAUSE!!!\",1,1

If KeyHit(57)
game_zustand = game_haupt
EndIf

Flip
Until game_zustand<>temp_zustand

End Function


Danke schon im Vorraus

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group