Spielfigur Doppelt

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

tobias185

Betreff: Spielfigur Doppelt

BeitragMi, Jun 01, 2005 14:40
Antworten mit Zitat
Benutzer-Profile anzeigen
ICh schreibe gerade ein Jump and run spiel aber meine spielfigur ist doppelt auf dem bildschirm einmal normal zum laufen und springen und einmal an dem oberen rand des bildschirms die sich mit seitwärts in beide richtungen bewegt.
Weis jehmand wie ich die obere wegbekomme???
 

gamble

BeitragMi, Jun 01, 2005 14:56
Antworten mit Zitat
Benutzer-Profile anzeigen
Da oben einfach keine zeichnen? Wink

Mal im Ernst, poste mal deinen Code, wir sind ja auch keine Wahrsager.
 

tobias185

BeitragMi, Jun 01, 2005 15:10
Antworten mit Zitat
Benutzer-Profile anzeigen
das ist meine funktion um den player laufen zu lassen


BlitzBasic: [AUSKLAPPEN]
Function Moveplayer()	
If KeyDown(links) Then
If map(player_pos_x /32,(player_pos_y +16) /32)=0 Then
player_pos_x = player_pos_x -4 ;X-position -4
If player_pos_x =< 0 Then player_pos_x = 1
EndIf
ElseIf KeyDown(rechts) Then
If map((player_pos_x +32) /32,(player_pos_y +16) /32)=0 Then
player_pos_x = player_pos_x +4
If player_pos_x => 608 Then player_pos_x = 607
EndIf
EndIf
End Function

Spikespine

BeitragMi, Jun 01, 2005 15:17
Antworten mit Zitat
Benutzer-Profile anzeigen
Aha.
Und an diesem fetzen Code sollen wir also herausfinden, warum Die Spielfigur doppelt gezeichnet wird?

Spike
Athlon 64 3700+ | 1024 MB RAM | GeForce 7900 GT | Blitz2D, Blitz3D, BlitzPlus, BlitzMax
 

tobias185

BeitragMi, Jun 01, 2005 15:25
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich habe gedacht das der fehler in diesen stück liegen soll.


BlitzBasic: [AUSKLAPPEN]
Graphics 640,480

SetBuffer BackBuffer()
frametimer = CreateTimer (30)
ClsColor 0, 0, 255


Global teile = LoadImage (\"teile1.bmp\")
MaskImage teile, 255,0,255
Global tobias = LoadImage (\"tobias.bmp\")
MaskImage tobias, 255,0,255


Global player_pos_x = 200
Global player_pos_y = 320
Global player_temp_y# = 0
Global jump
Global jumptimer#

Const rauf = 200, runter = 208, rechts = 205, links = 203, space = 57


Dim map (20,15)

Restore mapdata
For y=0 To 14
For x=0 To 19
Read map(x,y)
Next
Next


Repeat
Cls
WaitTimer (frametimer)

Drawmap()
Movetobias()
Dojump()
Drawplayer()

DrawImage tobias, player_pos_x, player_pas_y

Flip

Until KeyHit (1)
End


Function Drawmap()
For y = 0 To 14
For x = 0 To 19
If map(x,y) = 1 Then
DrawImage teile, x*32, y*32
EndIf
Next
Next
End Function

Function Movetobias()
If KeyDown(links) Then
If map(player_pos_x /32,(player_pos_y +16) /32)=0 Then
player_pos_x = player_pos_x -4 ;X-position -4
If player_pos_x =< 0 Then player_pos_x = 1
EndIf
ElseIf KeyDown(rechts) Then
If map((player_pos_x +32) /32,(player_pos_y +16) /32)=0 Then
player_pos_x = player_pos_x +4
If player_pos_x => 608 Then player_pos_x = 607
EndIf
EndIf
End Function

Function Dojump()
If KeyDown(space) Then
If jump = False
jump = True
player_temp_y = 15
EndIf
EndIf


If map((player_pos_x +16) /32, player_pos_y /32)=1 And jump = True Then
jump = False
player_pos_y = player_pos_y +1
EndIf


If jump = True Then
player_temp_y = player_temp_y -0.33
player_pos_y = player_pos_y - player_temp_y

If player_temp_y =< 0 Then
If map((player_pos_x +16) /32,(player_pos_y +32) /32)=1 Then
jump = 0
temp = player_pos_y /32
player_pos_y = temp *32
EndIf
EndIf
EndIf


If jump = False Then
If map((player_pos_x +16) /32,(player_pos_y +32)/32)=0 Then
jump = True
player_temp_y = 0
EndIf
EndIf


If player_pos_y =< 0 Then
player_pos_y = 1
jump = True
player_temp_y = 0
EndIf

If player_pos_y => 448 Then
player_pos_y = 447
jump = False
EndIf

End Function

Function drawplayer()
DrawImage tobias, player_pos_x, player_pos_y
End Function





.mapdata
Data 0,0,0,0,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,0,0,0,0
Data 0,0,0,0,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,0,0,0,0
Data 0,0,0,0,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,0,0,0,0
Data 0,0,0,0,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,0,0,0,0
Data 0,0,0,0,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,0,0,0,0
Data 0,0,0,0,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,1,1,1,1,0,0,0,0,0,0,0
Data 0,0,0,0,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,0,0,0,0
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

maximilian

BeitragMi, Jun 01, 2005 15:32
Antworten mit Zitat
Benutzer-Profile anzeigen
player_pas_y duch player_pos_y ersetzen.

LordChaos
Variety is the spice of life. One day ignore people, next day annoy them.
 

tobias185

BeitragMi, Jun 01, 2005 15:35
Antworten mit Zitat
Benutzer-Profile anzeigen
Dank dir LordChaos muss ich wol übersehen haben den Fehler.
 

hitokiri

BeitragMi, Jun 01, 2005 16:24
Antworten mit Zitat
Benutzer-Profile anzeigen
um...wieso zeichnest du ihn eigentlich überhaupt 2mal ?
einmal in der function drawplayer und dann nochmal einfach so vorm flip o.O ?
 

E. Urbach

ehemals "Basicprogger"

BeitragDo, Jun 02, 2005 14:53
Antworten mit Zitat
Benutzer-Profile anzeigen
@ hitokiri
Vielleicht wollte er ja Multiplayer proggen Very Happy ?
Oder 2 Leben haben Very Happy ?
Oder auch einfach nur die Spielgeschwindigkeit reduzieren Very Happy ?

@ tobias185
Nein, Spam beiseite:
Ich würd auch gern wissen wieso du das tust.
The box said, "Requires Windows XP or better", so I installed Ubuntu | Linux is NOT Windows
Flua :: Profiler für BB und BMax :: Partikel-Engine für BMax :: Lyphia-Projekt Quellcode (BMax) :: Automatische Parallelisierung :: Meine Musik

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group