Map verschiebt sich
Übersicht

![]() |
ToeBBetreff: Map verschiebt sich |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hailo @ All !
Ich progge grad ein Spiel, "Smiley Run", und da gibt es eine Map, die unter dem "Smiley" bewegt wird(Dann kann man größere Maps wählen ![]() Code: [AUSKLAPPEN] Graphics 300,300,16,2 SetBuffer BackBuffer() AppTitle "Smiley Run" SeedRnd MilliSecs() Type w Field x Field y Field s Field z Field w End Type Global d.w Const Anzahl_Der_Kisten = 4 Global sx = ((GraphicsWidth()/2)/31),sy = ((GraphicsHeight()/2)/31) Global MapX = 20,MapY = 20,R = 1:Dim Map(MapX,MapY):Dim Player(4):Dim Ziel(2) Global MapScroll_X = 2 Global MapScroll_Y = 2 Global Kiste = LoadImage("gfx\Kiste.bmp") Global Stein = LoadImage("gfx\Stein.bmp") Global Dynamit = LoadImage("gfx\Dynamit.bmp") Global Boden = LoadImage("gfx\Boden.bmp") Ziel(1) = LoadImage("gfx\Ziel1.bmp") Ziel(2) = LoadImage("gfx\Ziel2.bmp") MaskImage Dynamit,255,0,255 For i = 1 To 4 Player(i) = LoadImage("gfx\Play_"+i+".bmp") MaskImage Player(i),255,0,255 Next For y = 1 To MapY For x = 1 To MapX Read Map(x,y) Next Next For i = 1 To 100 x = Rand(2,MapX-1) y = Rand(2,MapY-1) If Map(x,y) = 0 Then Map(x,y) = 1 Next alt = MilliSecs() Repeat ox = MapScroll_X oy = MapScroll_Y If KeyDown(200) Then R = 3:MapScroll_Y = MapScroll_Y + 1 If KeyDown(208) Then R = 1:MapScroll_Y = MapScroll_Y - 1 If KeyDown(203) Then R = 2:MapScroll_X = MapScroll_X + 1 If KeyDown(205) Then R = 4:MapScroll_X = MapScroll_X - 1 If MapScroll_X > 2 Then MapScroll_X = 2 If MapScroll_Y > 2 Then MapScroll_Y = 2 If MapScroll_X < -(MapX-5) Then MapScroll_X = -(MapX-5) If MapScroll_Y < -(MapY-5) Then MapScroll_Y = - (MapY-5) If KeyHit(57) Then d.w = New w d\x = sx d\y = sy d\s = 3 d\z = MilliSecs() EndIf For y = 1 To MapY For x = 1 To MapX If Map(x,y) = 1 Then If ImagesOverlap(Stein,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then MapScroll_X = ox MapScroll_Y = oy EndIf DrawImage Stein,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf If Map(x,y) = 0 Then DrawImage Boden,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If Map(x,y) = 2 Then If ImagesOverlap(Kiste,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then MapScroll_X = ox MapScroll_Y = oy EndIf DrawImage Kiste,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf If Map(x,y) = 5 Then DrawImage Ziel(Ziel_Var+1),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If ImagesOverlap(Ziel(Ziel_Var+1),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then DrawImage Ziel(2),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf EndIf Next Next If alt <= MilliSecs() - 2000 Then Ziel_Var = 1 - Ziel_Var alt = MilliSecs() EndIf DrawImage Player(R),sx*31,sy*31 Color 255,255,255:Text 1,1 ,"MapX : "+mapscroll_x Color 255,255,255:Text 1,15,"MapY : "+mapscroll_y Flip Cls Until KeyHit(1) End .Map_Data Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 So, wie ihr seht, habe ich das Image "Stein" auf Collisions geprüft. Wenn der Spieler mit dem Stein Kollidiert, dann soll die MapScroll-Variablen auf die Old-Variablen(ox;oy) gesetzt werden. Aber dann verschiebt sich die Map darüber ! Hier mal der Download, damit ihr seht was ich meine : Klick Mich |
||
Religiöse Kriege sind Streitigkeiten erwachsener Männer darum, wer den besten imaginären Freund hat.
Race-Project - Das Rennspiel der etwas anderen Art SimpleUDP3.0 - Neuste Version der Netzwerk-Bibliothek Vielen Dank an dieser Stelle nochmal an Pummelie, welcher mir einen Teil seines VServers für das Betreiben meines Masterservers zur verfügung stellt! |
BIG BUG |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Naja, das ist ja auch logisch, da Du das die Kollisionsprüfung und das Zeichnen in einer einzigen Schleife durchführst.
Das Zeichnen der Grafiken darf erst erfolgen, wenn die Abwicklung der Spiellogik erledigt ist... |
||
B3D-Exporter für Cinema4D!(V1.4)
MD2-Exporter für Cinema4D!(final) |
![]() |
ToeB |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hey Danke BIG BUG ! Jetzt funzt es ![]() ~EDIT~ Neues problem ![]() Ich will jetzt das Dynamit auf die Position von dem Spieler malen, wenn man die Leertaste drückt . Es soll aber immer noch auf der Map gemalt bleiben... Code: [AUSKLAPPEN] Graphics 300,300,16,2
SetBuffer BackBuffer() AppTitle "Smiley Run" SeedRnd MilliSecs() Type w Field x Field y Field s Field z Field w End Type Global d.w Const Anzahl_Der_Kisten = 10 Global sx = ((GraphicsWidth()/2)/31),sy = ((GraphicsHeight()/2)/31) Global MapX = 20,MapY = 20,R = 1:Dim Map(MapX,MapY):Dim Player(4):Dim Ziel(2) Global MapScroll_X = -5 Global MapScroll_Y = -5 Global Kiste = LoadImage("gfx\Kiste.bmp") Global Stein = LoadImage("gfx\Stein.bmp") Global Dynamit = LoadImage("gfx\Dynamit.bmp") Global Boden = LoadImage("gfx\Boden.bmp") Ziel(1) = LoadImage("gfx\Ziel1.bmp") Ziel(2) = LoadImage("gfx\Ziel2.bmp") MaskImage Dynamit,255,0,255 For i = 1 To 4 Player(i) = LoadImage("gfx\Play_"+i+".bmp") MaskImage Player(i),255,0,255 Next For y = 1 To MapY For x = 1 To MapX Read Map(x,y) Next Next For i = 1 To Anzahl_Der_Kisten x = Rand(2,MapX-1) y = Rand(2,MapY-1) If Map(x,y) <> 0 Then x = Rand(2,MapX-1) y = Rand(2,MapY-1) EndIf If Map(x,y) = 0 Then Map(x,y) = 2 Next alt = MilliSecs() Repeat oMSX = MapScroll_X oMSY = MapScroll_Y If KeyDown(200) Then R = 3:MapScroll_Y = MapScroll_Y + 1 If KeyDown(208) Then R = 1:MapScroll_Y = MapScroll_Y - 1 If KeyDown(203) Then R = 2:MapScroll_X = MapScroll_X + 1 If KeyDown(205) Then R = 4:MapScroll_X = MapScroll_X - 1 If MapScroll_X > 2 Then MapScroll_X = 2 If MapScroll_Y > 2 Then MapScroll_Y = 2 If MapScroll_X < -(MapX-5) Then MapScroll_X = -(MapX-5) If MapScroll_Y < -(MapY-5) Then MapScroll_Y = - (MapY-5) If KeyHit(57) Then d.w = New w d\x = sx d\y = sy d\s = 2 d\z = MilliSecs() EndIf For y = 1 To MapY For x = 1 To MapX If Map(x,y) = 1 Then If ImagesOverlap(Stein,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then MapScroll_X = oMSX MapScroll_Y = oMSY EndIf EndIf If Map(x,y) = 2 Then If ImagesOverlap(Kiste,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then MapScroll_X = oMSX MapScroll_Y = oMSY EndIf DrawImage Kiste,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf If Map(x,y) = 5 Then If ImagesOverlap(Ziel(Ziel_Var+1),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31),Player(R),sx*31,sy*31) Then DrawImage Ziel(2),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf EndIf Next Next For y = 1 To MapY For x = 1 To MapX If Map(x,y) = 0 Then DrawImage Boden,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If Map(x,y) = 1 Then DrawImage Stein,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If Map(x,y) = 2 Then DrawImage Kiste,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If Map(x,y) = 5 Then DrawImage Ziel(Ziel_Var+1),(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) If Map(x,y) = 3 Then DrawImage Boden,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) DrawImage Dynamit,(MapScroll_X*31)+(x*31),(MapScroll_Y*31)+(y*31) EndIf Next Next If alt <= MilliSecs() - 2000 Then Ziel_Var = 1 - Ziel_Var alt = MilliSecs() EndIf DrawImage Player(R),sx*31,sy*31 For d.w = Each w DrawImage Dynamit,(MapScroll_X*31)+d\x*31,(MapScroll_Y*31)+d\y*31 Next Color 255,255,255:Text 1,1 ,"MapX : "+mapscroll_x Color 255,255,255:Text 1,15,"MapY : "+mapscroll_y Flip Cls Until KeyHit(1) End .Map_Data Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 Data 1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1 Data 1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1 Data 1,1,0,1,1,0,1,1,0,1,1,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 könnt ihr mir ein weiteres mal helfen ? biiittteeee.... ![]() |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group