Problem mit Tilemap und Steuerung

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

 

Hi

Betreff: Problem mit Tilemap und Steuerung

BeitragSo, Sep 09, 2007 21:39
Antworten mit Zitat
Benutzer-Profile anzeigen
Also ich hab da ein Problem mit einer Tilemap mit Scroll Funktion (Pixel by Tile) und einer Gta ähnlichen Steuerung die eingebaut werden soll.

Ich habe eine einfache Tilemap mit normaler Steuerung und Scroll:

Code: [AUSKLAPPEN]
Graphics 1280,960,32,1

tileseta = LoadAnimImage("Texturen von Racer\Textur Tileset.jpg",32,32,0,2)

img = LoadImage("Texturen von Racer\Autos\Auto2\auto.jpg")


Global ppx = 10*32
Global ppy = 10*32

Global px = 10
Global py = 10

Global scrollx
Global scrolly

move = 1


Dim map(20,20)


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

For y = 0 To 20
For x = 0 To 20
Read map(x,y)
Next
Next

Repeat
SetBuffer BackBuffer()
Cls
If KeyDown(1) Then End


For y = 0 To 20
For x = 0 To 20
DrawBlock tileseta,x*32-scrollx,y*32-scrolly,map(x,y)
Next
Next

DrawImage img,ppx-scrollx,ppy-scrolly

If move = 1 Then
If aa > 0
scrolly = scrolly + 2
ppy = ppy + 2
xo = xo + 1
If xo = 16 Then aa = 0:py = py + 1:xo = 0
End If
End If

If move = 2 Then
If aa > 0
scrolly = scrolly - 2
ppy = ppy - 2
xo = xo + 1
If xo = 16 Then aa = 0:py = py - 1:xo = 0
End If
End If

If move = 3 Then
If aa > 0
scrollx = scrollx - 2
ppx = ppx - 2
xo = xo + 1
If xo = 16 Then aa = 0:px = px - 1:xo = 0
End If
End If

If move = 4 Then
If aa > 0
scrollx = scrollx + 2
ppx = ppx + 2
xo = xo + 1
If xo = 16 Then aa = 0:px = px + 1:xo = 0
End If
End If

If KeyDown(205) Then
If map(px+2,py) < 1 Then
If aa < 1 Then
move = 4
aa = 1
End If
End If
End If

If KeyDown(203) Then
If map(px-1,py) < 1 Then
If aa < 1 Then
move = 3
aa = 1
End If
End If
End If

If KeyDown(200) Then
If map(px,py-1) < 1 Then
If aa < 1 Then
move = 2
aa = 1
End If
End If
End If

If KeyDown(208) Then
If map(px,py+1.5) < 1 Then 
If aa < 1 Then
move = 1
aa = 1
End If
End If
End If

Flip
Forever


Und ich habe die Gta Steuerung:

Code: [AUSKLAPPEN]
Graphics 1280,1024,32,1

Dim img(360)

img(0) = LoadImage ("Texturen von Racer\Autos\Auto2\auto.jpg")
MaskImage img(0),0,0,0
MidHandle img(0)
SetBuffer ImageBuffer(img(0))
SetBuffer BackBuffer()


For ri# = 1 To 360
img(ri#) = CopyImage(img(0))
RotateImage img(ri#), ri#
Next

x = 0
y = 0

posx# = 40
posy# = 30

ri# = 1.0

textur1 = LoadImage("Texturen\textur1.jpg")

speed# = 0.00

Repeat

For xmal = 1 To 100
If speed# > 5.0 Then speed#=5.0
If KeyDown(200) Then speed#=speed# + 0.0001
If speed# >= 0.1 Then
If KeyDown(200) Then speed#=speed# + 0.001
EndIf
If speed# < 0.0 Then
If KeyDown(200) Then speed#=speed# + 0.001
EndIf
If Not KeyDown (200) Then Exit
Next

For xmal = 1 To 100
If KeyDown(208) Then speed#=speed# - 0.001
If Not KeyDown(208) Then Exit
Next

If KeyDown(203) Then ri#=ri#-4.0
If KeyDown(205) Then ri#=ri#+4.0
If ri < 0 Then ri#=ri#+359
If ri > 359 Then ri#=ri#-359

posx = posx + Cos(ri#)*speed
posy = posy + Sin(ri#)*speed

DrawImage textur1,x,y

DrawImage img(ri#), posx, posy

Flip:Cls
Until KeyHit(1)

WaitKey
End


Jetzt muss ich das zu einem Code zusammen führen und es funktioniert auch soweit nur mein Problem ist jetzt das ich hier statt dem Auto die gesamte Karte rotieren lassen muss und die liegt ja nur in einzelnen tiles vor.
Deshalb weiss ich nicht wie ich die gesamte Karte rotieren lassen kann.

Thx schonmal im voraus.

hectic

Sieger des IS Talentwettbewerb 2006

BeitragSo, Sep 09, 2007 22:33
Antworten mit Zitat
Benutzer-Profile anzeigen
Mit 2D-Befehlen wirst du ein Problem haben, die Map langsam rotieren zu lassen. Falls dir aber sprungartige Drehbewegung um 90° auch genügen, so kannst du einfach die Map entsprechend anders auslesen (zB X/Y vertauschen etc.).

Fallso Blitz3D hast, kannst du die Tiles als Mesh anzeigen und entsprechend mit der Kamera rum fahren und drehen.
Download der Draw3D2 V.1.1 für schnelle Echtzeiteffekte über Blitz3D

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group