Map-bewegung
Übersicht

![]() |
ToeBBetreff: Map-bewegung |
![]() Antworten mit Zitat ![]() |
---|---|---|
Also...
Ich wollte das meine Figur immer nur ein Feld auf der Map weitergeht. aber nicht ruckhaft, sondern er geht solage in eine richtung, bis er das nächste tile erreicht hat (wenn dass dann doch frei ist) aber iwie klappt das nicht so wie ich es will ![]() Code: [AUSKLAPPEN] XX = pl(0,0)/25
YY = pl(0,1)/25 If pl(0,6) = 0 If KeyDown(200) Then If map(XX,YY-1) = 0 Then pl(0,6) = 1:pl(0,7) = XX:pl(0,8) = YY-1 EndIf EndIf If KeyDown(208) Then If map(XX,YY+1) = 0 Then pl(0,6) = 3:pl(0,7) = XX:pl(0,8) = YY+1 EndIf EndIf If KeyDown(203) Then If map(XX-1,YY) = 0 Then pl(0,6) = 2:pl(0,7) = XX-1:pl(0,8) = YY EndIf EndIf If KeyDown(205) Then If map(XX-1,YY) = 0 Then pl(0,6) = 4:pl(0,7) = XX+1:pl(0,8) = YY EndIf EndIf Else Select pl(0,6) Case 1 pl(0,1) = pl(0,1) - 1 Case 3 pl(0,1) = pl(0,1) + 1 Case 2 pl(0,0) = pl(0,0) - 1 Case 4 pl(0,0) = pl(0,0) + 1 End Select If XX = pl(0,7) And YY = pl(0,8) Then pl(0,6) = 0 EndIf Das arry pl steht für die vier spieler (Dim pl(3,8)) . pl(x,0) = Xposition pl(x,1) = YPosition pl(x,5) = Startpunkt pl(x,6) = Bewegungs richtung pl(x,7) = Nächstes X Feld pl(x,8) = Nächstes Y Feld Aber warum klappt das nicht ? mfg ToeB |
||
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! |
![]() |
The Shark |
![]() Antworten mit Zitat ![]() |
---|---|---|
x/yposition und nächastesx/yfeld sin in felder und nicht in pixel, oder?
dann rechnest du die positionen einfach in pixel um, also bei ner feldgröße von 32 einfach mal 32, tust die werte speichern und schauen wenn Code: [AUSKLAPPEN] if xaktpos>xendpos then xaktpos=xaktpos-1 if xaktpos<xendpos then xaktpos=xaktpos+1 und für y genauso und wenn die positionen übereinstimmen, bist du angekommen |
||
![]() |
ToeB |
![]() Antworten mit Zitat ![]() |
---|---|---|
aso ^^ Danke ^^
mfg ToeB [EDIT] Funzt immer noch nicht richtig !? Code: [AUSKLAPPEN] XX = pl(0,0)/25
YY = pl(0,1)/25 If pl(0,6) = 0 If KeyDown(200) Then If map(XX,YY-1) = 0 Then pl(0,6) = 1:pl(0,7) = XX*25:pl(0,8) = YY*25-25 EndIf EndIf If KeyDown(208) Then If map(XX,YY+1) = 0 Then pl(0,6) = 1:pl(0,7) = XX*25:pl(0,8) = YY*25+25 EndIf EndIf If KeyDown(203) Then If map(XX-1,YY) = 0 Then pl(0,6) = 1:pl(0,7) = XX*25-25:pl(0,8) = YY*25 EndIf EndIf If KeyDown(205) Then If map(XX-1,YY) = 0 Then pl(0,6) = 1:pl(0,7) = XX*25+25:pl(0,8) = YY*25 EndIf EndIf Else If pl(0,0) < pl(0,7) Then pl(0,0) = pl(0,0) + 2 If pl(0,0) > pl(0,7) Then pl(0,0) = pl(0,0) - 2 If pl(0,1) < pl(0,8) Then pl(0,1) = pl(0,1) + 2 If pl(0,1) > pl(0,8) Then pl(0,1) = pl(0,1) - 2 If pl(0,0) = pl(0,7) And pl(0,1) = pl(0,8) Then pl(0,6) = 0 EndIf Warum ? mfg ToeB |
||
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! |
![]() |
The Shark |
![]() Antworten mit Zitat ![]() |
---|---|---|
Weil du einal die felder un einmal die pixel brauchst.
Du rechnest aber nur mit feldern [EDIT:] Beispiel: Code: [AUSKLAPPEN] Graphics 400,300,0,2 SetBuffer BackBuffer() timer=CreateTimer(60) Local px,py,startx,starty,endx,endy,bewegung While Not KeyDown(1) WaitTimer(timer) Cls If bewegung=0 startx=px*20 starty=py*20 If KeyDown(200);oben endx=startx endy=starty-20 py=py-1 bewegung=1 ElseIf KeyDown(208);unten endx=startx endy=starty+20 py=py+1 bewegung=1 ElseIf KeyDown(203);links endx=startx-20 endy=starty px=px-1 bewegung=1 ElseIf KeyDown(205);rechts endx=startx+20 endy=starty px=px+1 bewegung=1 EndIf Else If startx>endx startx=startx-1 ElseIf startx<endx startx=startx+1 EndIf If starty>endy starty=starty-1 ElseIf starty<endy starty=starty+1 EndIf If startx=endx And starty=endy Then bewegung=0 EndIf Rect startx,starty,20,20 Flip 0 Wend End |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group