Scrolling in mapeditor ...(Bitte hilfe!)

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

dimaster

Betreff: Scrolling in mapeditor ...(Bitte hilfe!)

BeitragDo, Apr 08, 2004 17:16
Antworten mit Zitat
Benutzer-Profile anzeigen
Also ich habe da son map-editor zusammen gebastelt und möchte nun scrollen können wie geht das?
__________________________________________________________
Hier mein
Code: [AUSKLAPPEN]
Dim map(40,31)
Graphics 1280,1024,16,1
Tileset = LoadAnimImage("gfx/tileset2.bmp",32,32,0,17)
Maus = LoadImage("gfx/maus.bmp")
Global x,y,mx,my,mapx,mapy,tile = 1
Repeat
Cls

SetBuffer BackBuffer()

If KeyDown(1) Then End
For x = 0 To 40
For y = 0 To 31
DrawImage tileset,x*32,y*32,map(x,y)
Next
Next

If KeyDown(2) Then tile = 1
If KeyDown(3) Then tile = 2
If KeyDown(4) Then tile = 3
If KeyDown(5) Then tile = 4
If KeyDown(7) Then tile = 5
If KeyDown(8) Then tile = 6
If KeyDown(9) Then tile = 7
If KeyDown(10) Then tile = 8
If KeyDown(11) Then tile = 9
If KeyDown(12) Then tile = 10
If KeyDown(13) Then tile = 11
If KeyDown(14) Then tile = 12
If KeyDown(15) Then tile = 13
If KeyDown(16) Then tile = 14
If KeyDown(17) Then tile = 15
If KeyDown(18) Then tile = 16

 If KeyHit(57) Then
  SaveBuffer(FrontBuffer(),"shot" + Str$(Shot) + ".bmp")
  Shot = Shot + 1
 EndIf

mx = MouseX()
my = MouseY()
If MouseDown(1) Then
scroll()
map(mapx,mapy) = tile
End If

If MouseDown(2) Then
scroll()
map(mapx,mapy) = 0
End If


If KeyHit(31) Then save()

If KeyHit(38) Then load()

DrawImage maus,mx,my

Flip
Forever


Function scroll()

mapx = (mx)/32
mapy = (my)/32
End Function


Function save()

karte$ = WriteFile("maps/map1.map")

For x = 0 To 40
For y = 0 To 31

WriteLine(karte$,tile)

WriteInt(karte$,map(x,y))
Next
Next

CloseFile(karte$)
End Function

 
Function load()

karte$ = ReadFile("maps/map1.map")

For x = 0 To 40
For y = 0 To 31
tile = ReadLine(karte$)
map(x,y) = ReadInt(karte$)
Next
Next

CloseFile(karte$)
End Function

Bitte helft mir meine maps sind viel zu klein!!

Hubsi

BeitragDo, Apr 08, 2004 18:44
Antworten mit Zitat
Benutzer-Profile anzeigen
Für einen Editor reichts wohl wenn man tile-weise scrollen kann. Dazu brauchst Du noch eine Variable (z.B. starttile) und die Zeichenschleife könnte dann so aussehen:
Code: [AUSKLAPPEN]
For y=0 To weis_ich_nicht
  For x=starttile To starttile+tiles_pro_bildschirm
    DrawImage tile,x-starttile*32,y*32
  Next
Next

starttile darf dann solange erhöht werden bis es mapbreite-tiles_pro_bildschirm erreicht hat und verringern bis es 0 erreicht. Beim setzen der Tiles rechnest Du auch einfach starttile dazu.

Edit: Weil ich das grad sehe: WriteFile gibt (wie auch ReadFile) keinen String zurück.

Wenn ich noch ein wenig egoistisch sein darf: Mach das Spiel bitte in einer geringeren Auflösung. 1280*1024 schafft mein Bildschirm nicht Very Happy
Den ganzen Doag im Bett umanandflagga und iaz daherkema und meine Hendl`n fressn...

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group