Move Probleme! - Wo liegt der Fehler?
Übersicht

D@NieLBetreff: Move Probleme! - Wo liegt der Fehler? |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi all!!!
Ich sitze (schon wieder) an einem neuen Projekt... Und ich wundere mich wieso ein einfacher Befehl nicht funktioniert!! Ich will meinen Player bewegen aber nichts geschieht... und wenn ich MovePlayer() vor DrawMap() schreibe dann funzt nicht mal das... Hier der Code: Code: [AUSKLAPPEN] Global playery = 0 Global playerx = 0 Global player_frame = 2 Global Start = 1 Global Speed = 4 Global Score = 0 Global Tod = 1 Const rauf = 200, runter = 208, rechts = 205, links = 203, space = 57 ; Hauptschleife Repeat Text 620,100, "Punkte: " Text 680,100, Score DrawPlayer() DrawMap() MovePlayer() Until KeyHit(1) Flip End ; Functionen Function MovePlayer() If KeyDown(runter) Then playery = playery + Speed EndIf End Function Function DrawPlayer() If Tod > 0 Then DrawImage player, playerx, playery, Player_frame EndIf End Function Function DrawMap() DrawImage Line1,600,0 ;For C = 0 To 14 Step 2 ; For D = 1 To 14 ; DrawImage Sand,C*40,D*40,0 ; DrawImage Sand,D*40,C*40,0 ; Next ;Next For C = 1 To 14 Step 2 For D = 1 To 14 Step 2 DrawImage Metal,C*40,D*40 Next Next End Function Was ist da los??? Bitte um Hilfe!!! ![]() Lg Daniel |
||
![]() |
Fleamor |
![]() Antworten mit Zitat ![]() |
---|---|---|
hmmmm... du hast doch nicht etwa Runter im Quelltext zu stehen oder?
edit:sry hab erst die const nicht im Quelltext gesehen. naja da gibts schon verbesserungswürdiges von der From her z.B. Code: [AUSKLAPPEN] Text 620,100, "Punkte: "
Text 680,100, Score würde man normalerweise schreiben: Code: [AUSKLAPPEN] Text 620,100,"Punkte" + Score
und das mit den Const würd ich weglassen und die Zahlen direkt schreiben. |
||
- Zuletzt bearbeitet von Fleamor am Di, Mai 02, 2006 18:29, insgesamt 2-mal bearbeitet
![]() |
Geeecko |
![]() Antworten mit Zitat ![]() |
---|---|---|
mach vllt. mal die " " (leerzeichen bei den const weg). | ||
![]() |
Bud |
![]() Antworten mit Zitat ![]() |
---|---|---|
Welchen Buffer hast du vorher eingestellt? Wenns der BackBuffer() ist, dann musst die Schleife natürlich so aussehen:
Code: [AUSKLAPPEN] Repeat
Cls Text 620,100, "Punkte: " Text 680,100, Score DrawPlayer() DrawMap() MovePlayer() Flip Until KeyHit(1) |
||
D@NieL |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
*gg* ups...
hab das flip nach until gemacht ![]() ![]() Danke für eure Hilfe!!! @ Gaia: Hab dir ne mail geschrieben!!!! glg Daniel PS: Werde wegen den Explosionen wahrscheinlich nocheinmal kommen!! ![]() |
||
D@NieL |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hi nochmal...
bin noch am gleichen Game dran (nur nebenbei) und komm aber schon bei dem problem nicht mehr weiter: Hatte alles super funktioniert mit bewegen und co, doch dann hab ich (wie bei bomberman) das problem wenn ich unzerstörbare (undurchlaufbare) steine mit data mach dann kann ich mich garnicht mehr bewegen... Code: [AUSKLAPPEN] Graphics 800,600,32,2 SetBuffer BackBuffer() Global Metal = LoadImage("Graphics/Metal2.bmp") MaskImage Metal,255,0,255 Global Line1 = LoadImage("Graphics/Line1.bmp") Global player = LoadAnimImage("Graphics/player2.bmp",32,32,0,8) MaskImage player,255,0,255 Global Sand = LoadAnimImage("Graphics/Kiste1.bmp",40,40,0,2) MaskImage Sand,255,0,255 Global Sterne = LoadImage("Graphics/stars.bmp") MaskImage Sterne,255,0,255 Global Hauptmenü = LoadImage("Graphics/Hauptmenü.bmp") Global playery = 0 Global playerx = 0 Global player_frame = 2 Global player_counter = 30 Global Menü = 0 Global Speed = 5 Global Score = 0 Global Tod = 1 Const rauf=200,runter=208,rechts=205,links=203,space=57 Dim map(15,16) ; Hauptschleife Repeat Cls Text 620,100, "Punkte: " + Score DrawPlayer() DrawMap() MovePlayer() SetupLevel() Flip Until KeyHit(1) End ; Functionen Function MovePlayer() If KeyHit(links) Then If Player_frame <6 Then Player_frame = 6 Player_Counter = Player_Counter -1 If Player_Counter = 0 Then Player_Counter = 35 Player_Frame = Player_Frame + 1 If Player_Frame >7 Then Player_Frame = 6 EndIf If map(Player_pos_x /32,(Player_pos_y +16) /32)=0 Then Player_pos_x = Player_pos_x - Speed If Player_pos_x =< 0 Then Player_pos_x = 1 EndIf ElseIf KeyDown(rechts) Then If Player_Frame >3 Or Player_Frame <2 Then Player_Frame = 2 Player_Counter = Player_Counter - 1 If Player_Counter = 0 Then Player_Counter = 35 Player_Frame = Player_Frame +1 If Player_Frame >3 Then Player_Frame = 2 EndIf If map((Player_pos_x +32) /32,(Player_pos_y +16) /32)=0 Then Player_pos_x = Player_pos_x + Speed If Player_pos_x => 608 Then Player_pos_x = 607 EndIf ElseIf KeyDown(rauf) Then If Player_frame >1 Then Player_frame = 0 Player_Counter = Player_Counter -1 If Player_Counter = 0 Then Player_Counter = 35 Player_Frame = Player_Frame + 1 If Player_Frame >1 Then Player_Frame = 0 EndIf If map((Player_pos_x +16) /32,Player_pos_y /32)=0 Then Player_pos_y = Player_pos_y - Speed If Player_pos_y =< 0 Then Player_pos_y = 1 EndIf ElseIf KeyDown(runter) Then If Player_frame <4 Then Player_frame = 4 Player_Counter = Player_Counter -1 If Player_Counter = 0 Then Player_Counter = 35 Player_Frame = Player_Frame + 1 If Player_Frame >5 Then Player_Frame = 4 EndIf If map((Player_pos_x +16) /32,(Player_pos_y +32) /32)=0 Then Player_pos_y = Player_pos_y + Speed If Player_pos_y => 448 Then Player_pos_y = 447 EndIf EndIf End Function Function DrawMap() DrawImage Line1,600,0 For y = 0 To 13 For x = 0 To 15 If map(x,y) = 1 Then DrawImage Metal, x*32, y*32 EndIf Next Next End Function Function DrawPlayer() DrawImage player, playerx, playery, Player_frame End Function Function SetupLevel() Restore mapdata For y=0 To 13 For x=0 To 15 Read map(x,y) Next Next End Function .mapdata Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,1,1,1,1,1,0,1,1,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 hab schon 2 arten ausprobiert... was ist der fehler, wie kann ichs besser machn??? Lg D@niel |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
Einmal hast du das ...
Global playery = 0 Global playerx = 0 Und in deiner MovePlayer() benutzt du Player_pos_x Player_pos_y das muß doch bestimmt playery playerx heißen! |
||
[BB2D | BB3D | BB+]
|
D@NieL |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
supa:) danke....
~rallimen: retter in der not~ ![]() komme sicher wieder wegen den bombenexplosionen. Nochmal vielen dank!!! Lg D@niel |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group