geht das so? oO

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

nagl

Betreff: geht das so? oO

BeitragMo, Aug 09, 2004 10:35
Antworten mit Zitat
Benutzer-Profile anzeigen
so ich habe meine tileengine mit mehreren layern so aufgebaut:
(ich habe noch kein "map-speichern" und lesen" gemacht sondern benutze daher noch die good oldschool-DATAS...
hier erstmal der code:


Code: [AUSKLAPPEN]
Graphics 320,240,16,1

Global char_oben = LoadanimImage("grakas/char.png",24,32,0,3)
Global char_rechts = LoadAnimImage("grakas/char.png",24,32,12,3)
Global char_unten = LoadAnimImage("grakas/char.png",24,32,24,3)
Global char_links = LoadAnimImage("grakas/char.png",24,32,36,3)
Global tileset = LoadAnimImage("grakas/wald1.png",16,16,0,480)
Global ppx = 5*32 ;X-Position des Charackters
Global ppy = 3*32  ;Y-Position des Charackters
Global py = 7      ;Kollisions X-Position des Charackters
Global px = 10     ;Kollisions Y-Position des Charackters
Global scrolly     ;Die Variable für die ScrollY-Position
Global scrollx     ;Die Variable für die ScrollX-Position

Dim map(20,20,3)


.ebene1
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77 ;77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77
; 77  im tileset als grafik  acker..die als begrenzung dienen sollen
;250 ist normales gras
.ebene2
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,58,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,358,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,58,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,358,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
;jetzt der 2. layer..selbe größe wie der 1. ...479 und 57 transparent
;358 ist ein busch ;)
;ich hab mir gedacht das der 2. layer auf derselben ebene ist wie die
;spielfigur..der kollision wegen wollte ich versch. werte haben
;if map(x,y,2)=57 then move()..so in etwa :D
Restore ebene1
For y = 0 To 20
For x = 0 To 20

Read map(x,y,1)
Next
Next

Restore ebene2
For y = 0 To 20
For x = 0 To 20

Read map(x,y,2)
Next
Next


Repeat

SetBuffer BackBuffer()

Cls
If KeyDown(1) Then End
;ebene1
For y = 0 To 20
For x = 0 To 20
DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,1)
Next
Next
;ebene2
For y = 0 To 20
For x = 0 To 20
MaskImage tileset, 0,117,117
DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,2)
Next
Next
MaskImage char_unten, 32,156,0
DrawImage char_unten,ppx-scrollx,ppy-scrolly,1
;------------------
.tastaturabfrage
If Keydown(200) Then oben()
If Keydown(208) Then unten()
If Keydown(203) Then links()
If Keydown(205) Then rechts()



Flip
Forever

 Function oben()
If map(px,py+1,2) = 57 Then
scrolly = scrolly - 2
ppy = ppy - 2
End Function

Function unten()
If map(px,py+1,2) = 57Then

scrolly = scrolly + 2
ppy = ppy + 2

End if
End Function

Function rechts()
If map(px+1,py,2) =57 Then
scrollx = scrollx + 2
ppx = ppx + 2

End if
End Function

Function links()
If map(px-1,py,2) =57 Then
scrollx = scrollx - 2
ppx = ppx - 2
End if
End Function


so meine figur kann sich bewegen jedoch komm ich mit der kollision net klar..
klappt halt net: Code: [AUSKLAPPEN]
If map(px-1,py,2) =57 Then

die 2. frage ist wie animier ich die figur das sie beim laufen verschiedene bilder anzeigt...in den tuts stand was von tileimage..das hab ich gar net kapiert oO..wär net wenn ihr mir helfen könntet.
(animation figur unten wäre:
DrawImage char_unten,x,y,0
DrawImage char_unten,x,y,1
DrawImage char_unten,x,y,2
nur wie schreibt man das, daß beim scrollen bzw. keydwon das auch passiert?...
thx im voraus
nagl
p.s. verbesserungsvorschläge mit der "engine" is erwünscht, diese is dafür gemacht das ich "noob" das auch kapier Wink
  • Zuletzt bearbeitet von nagl am Mo, Aug 09, 2004 11:01, insgesamt einmal bearbeitet

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 10:54
Antworten mit Zitat
Benutzer-Profile anzeigen
ähm,

Drücke dich mal etwas deutlicher aus, und den Quelltext bitee als Formatierte (eventuell ausdokumentierte Datei) zum Downloaden
-
ich versucher mal das, was bis jetzt steht zu verstehen
sieht auf den 1. Blick sehr n00big aus!
between angels and insects

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 11:19
Antworten mit Zitat
Benutzer-Profile anzeigen
So, die Collis gehen, habe die Charakter animation mal herrausgenommen.
Code: [AUSKLAPPEN]
Graphics 320,240,24,2

Global char_oben
Global char_rechts
Global char_unten
Global char_links
char_oben = LoadAnimImage("grakas/char.bmp",24,32,0,3)
char_rechts = LoadAnimImage("grakas/char.bmp",24,32,0,3)
char_unten = LoadAnimImage("grakas/char.bmp",24,32,0,3)
char_links = LoadAnimImage("grakas/char.bmp",24,32,0,3)
Global tileset = LoadAnimImage("grakas/wald1.bmp",16,16,0,480)
MaskImage tileset, 0,117,117
Global ppx = 5*32 ;X-Position des Charackters
Global ppy = 3*32 ;Y-Position des Charackters
Global py = 7 ;Kollisions X-Position des Charackters
Global px = 10 ;Kollisions Y-Position des Charackters
Global scrolly ;Die Variable für die ScrollY-Position
Global scrollx ;Die Variable für die ScrollX-Position

Global GW2,GH2
GW2=GraphicsWidth()/2
GH2=GraphicsHeight()/2
Dim map(20,20,3)


.ebene1
Data 77,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77 ;77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77
; 77 im tileset als grafik acker..die als begrenzung dienen sollen
;250 ist normales gras
.ebene2
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,58,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,358,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,58,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,358,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
;jetzt der 2. layer..selbe größe wie der 1. ...479 und 57 transparent
;358 ist ein busch ;)
;ich hab mir gedacht das der 2. layer auf derselben ebene ist wie die
;spielfigur..der kollision wegen wollte ich versch. werte haben
;if map(x,y,2)=57 then move()..so in etwa :D
Restore ebene1
For y = 0 To 20
For x = 0 To 20

Read map(x,y,1)
Next
Next

Restore ebene2
For y = 0 To 20
For x = 0 To 20

Read map(x,y,2)
Next
Next

SetBuffer BackBuffer()
Color 255,0,0
Repeat
   Cls
   If KeyDown(1) Then End
   ;ebene1
   For y = 0 To 20
      For x = 0 To 20
         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,1)
      Next
   Next
   ;ebene2
   For y = 0 To 20
      For x = 0 To 20

         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,2)
      Next
   Next
   MaskImage char_unten, 32,156,0
   DrawImage char_unten,ppx-scrollx,ppy-scrolly ,1
   Rect px*16-scrollx,py*16-scrolly,16,16,0
   ;------------------
   .tastaturabfrage
   If KeyDown(200) Then oben()
   If KeyDown(208) Then unten()
   If KeyDown(203) Then links()
   If KeyDown(205) Then rechts()
   Flip
Forever

Function oben()
   If map(px,py-1,2) = 57 Then
      scrolly = scrolly - 2
      ppy = ppy -2
      py =1+ ppy /16
   EndIf
End Function

Function unten()
   If map(px,py+1,2) = 57Then
      scrolly = scrolly + 2
      ppy = ppy +2
      py =1+ ppy /16
   End If
End Function

Function rechts()
   If map(px+1,py,2) =57 Then
      scrollx = scrollx + 2
      ppx = ppx +2
      px =1+ ppx /16
   End If
End Function

Function links()
   If map(px-1,py,2) =57 Then
      scrollx = scrollx - 2
      ppx = ppx -2
      px = 1+ppx /16
   End If
End Function
between angels and insects

nagl

BeitragMo, Aug 09, 2004 11:26
Antworten mit Zitat
Benutzer-Profile anzeigen
hmm, jan erstmal thx für deine schnelle antowort und danke für deine ehrliche meinung Laughing Zitat:
sieht auf den 1. Blick sehr n00big aus!

so hier der link zum download...
http://de.geocities.com/speedyskl/engine.zip
hoffe das is das was du meintest...
hier nochmal zur erklärung zu meinem code...
ich mach 2 ebenen...werden beide aus data ausgelesen
1. ebene befindet sich unter dem spieler
2. ebene auf derselben wie der spieler/charakter
ich will das meine kollision mithilfe der 2. ebene gemacht wird...
d.h es wird überprüft, ob das data-feld auf das sich der chara bewegt den wert 57 besitzt..ansonsten is ja ein gegenstand (kollision)..
das klappt aber irgendwie net..
meine 2. frage bezieht sich auf die spieleranimation...
die animation besteht aus 3 frames..
wie stelle ich diese animation dar, wenn ich keydown (z.b keydown(200) )
drücke..sollte realistisch aussehen...
so hoffe das macht das alles etwas deutlicher

cya nagl

p.s. @jan wenn du die grafiken benötigst muss ich die noch hochladen, hab das bis jetzt noch net gemacht Mad

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 11:28
Antworten mit Zitat
Benutzer-Profile anzeigen
Joa, Grafiken währen nicht schlecht (ich war schneller mit Prob nummer 1!)
between angels and insects

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 11:35
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
Graphics 320,240,24,2

Global char_oben = LoadAnimImage("grakas/char.bmp",24,32,0,3)
Global char_rechts = LoadAnimImage("grakas/char.bmp",24,32,12,3)
Global char_unten = LoadAnimImage("grakas/char.bmp",24,32,24,3)
Global char_links = LoadAnimImage("grakas/char.bmp",24,32,36,3)
Global tileset = LoadAnimImage("grakas/wald1.bmp",16,16,0,480)
MaskImage tileset, 0,117,117
Global ppx = 5*32 ;X-Position des Charackters
Global ppy = 3*32 ;Y-Position des Charackters
Global py = 7 ;Kollisions X-Position des Charackters
Global px = 10 ;Kollisions Y-Position des Charackters
Global scrolly ;Die Variable für die ScrollY-Position
Global scrollx ;Die Variable für die ScrollX-Position

Global time,animtime,animframe

Dim map(20,20,3)


.ebene1
Data 77,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77 ;77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77
; 77 im tileset als grafik acker..die als begrenzung dienen sollen
;250 ist normales gras
.ebene2
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,58,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,358,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,58,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,358,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
;jetzt der 2. layer..selbe größe wie der 1. ...479 und 57 transparent
;358 ist ein busch ;)
;ich hab mir gedacht das der 2. layer auf derselben ebene ist wie die
;spielfigur..der kollision wegen wollte ich versch. werte haben
;if map(x,y,2)=57 then move()..so in etwa :D
Restore ebene1
For y = 0 To 20
For x = 0 To 20

Read map(x,y,1)
Next
Next

Restore ebene2
For y = 0 To 20
For x = 0 To 20

Read map(x,y,2)
Next
Next

SetBuffer BackBuffer()
Color 255,0,0
Repeat
   Cls
   If KeyDown(1) Then End
   ;ebene1
   For y = 0 To 20
      For x = 0 To 20
         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,1)
      Next
   Next
   ;ebene2
   For y = 0 To 20
      For x = 0 To 20

         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,2)
      Next
   Next
   If animframe > 2 Then animframe = 0
   MaskImage char_unten, 32,156,0
   DrawImage char_unten,ppx-scrollx,ppy-scrolly ,animframe
   Rect px*16-scrollx,py*16-scrolly,16,16,0
   ;------------------
   .tastaturabfrage
   If KeyDown(200) Then oben()
   If KeyDown(208) Then unten()
   If KeyDown(203) Then links()
   If KeyDown(205) Then rechts()
   time = MilliSecs()
   Flip
Forever

Function oben()
   If map(px,py-1,2) = 57 Then
      If time +200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      
      scrolly = scrolly - 2
      ppy = ppy -2
      py =1+ ppy /16
   EndIf
End Function

Function unten()
   If map(px,py+1,2) = 57Then
      If time +200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      scrolly = scrolly + 2
      ppy = ppy +2
      py =1+ ppy /16
   End If
End Function

Function rechts()
   If map(px+1,py,2) =57 Then
      If time +200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      scrollx = scrollx + 2
      ppx = ppx +2
      px =1+ ppx /16
   End If
End Function

Function links()
   If map(px-1,py,2) =57 Then
      If time +200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      scrollx = scrollx - 2
      ppx = ppx -2
      px = 1+ppx /16
   End If
End Function
between angels and insects

nagl

BeitragMo, Aug 09, 2004 11:36
Antworten mit Zitat
Benutzer-Profile anzeigen
^^
...bei deinem code
kommt beim tileset..immer wrong image handle..
brb ich lad mal die grafiken hoch...
thx für deine hilfe jan..bin dir echt dankbar Wink
cu nagl

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 11:37
Antworten mit Zitat
Benutzer-Profile anzeigen
ja, habe andere Grafiken herreingeladen!

.bmp --> .png umwasndeln!
between angels and insects

nagl

BeitragMo, Aug 09, 2004 11:47
Antworten mit Zitat
Benutzer-Profile anzeigen
ach kagge..das hab ich net gesehn Wink...
naja b00nige augen halt ..
so hier is alles komplett:
http://de.geocities.com/speedyskl/rpg-demo.zip
so ich werd mal gleich deinen code angucken...
wenn das klappt wäre nur noch die frage mit der animation ....grad geshen Wink animframe ...klasse mal schaun obs geht
naja...
aso btw. is das mit den ebenen ne gängige lösung oder eher ungewöhnlich?...ich meine mit der transparenz etc...
cu nagl

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 11:57
Antworten mit Zitat
Benutzer-Profile anzeigen
So, ungefähr?
die Kollisionen müssten noch verbesser werden, sind aber schon annehmbar.

Code: [AUSKLAPPEN]
Graphics 320,240,24,2

Dim char(3)
char(0) = LoadAnimImage("grakas/char.png",24,32,0,3)
char(1) = LoadAnimImage("grakas/char.png",24,32,12,3)
char(2) = LoadAnimImage("grakas/char.png",24,32,24,3)
char(3) = LoadAnimImage("grakas/char.png",24,32,36,3)

For n = 0 To 3
MaskImage char(n), 32,156,0
Next

Global tileset = LoadAnimImage("grakas/wald1.png",16,16,0,480)
MaskImage tileset, 0,117,117
Global ppx = 5*32 ;X-Position des Charackters
Global ppy = 3*32 ;Y-Position des Charackters
Global py = 7 ;Kollisions X-Position des Charackters
Global px = 10 ;Kollisions Y-Position des Charackters
Global scrolly ;Die Variable für die ScrollY-Position
Global scrollx ;Die Variable für die ScrollX-Position

Global time,animtime,animframe,richtung

Dim map(20,20,3)


.ebene1
Data 77,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77 ;77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77
; 77 im tileset als grafik acker..die als begrenzung dienen sollen
;250 ist normales gras
.ebene2
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,58,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,358,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,58,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,358,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
;jetzt der 2. layer..selbe größe wie der 1. ...479 und 57 transparent
;358 ist ein busch ;)
;ich hab mir gedacht das der 2. layer auf derselben ebene ist wie die
;spielfigur..der kollision wegen wollte ich versch. werte haben
;if map(x,y,2)=57 then move()..so in etwa :D
Restore ebene1
For y = 0 To 20
For x = 0 To 20

Read map(x,y,1)
Next
Next

Restore ebene2
For y = 0 To 20
For x = 0 To 20

Read map(x,y,2)
Next
Next

SetBuffer BackBuffer()
Color 255,0,0
Repeat
   Cls
   If KeyDown(1) Then End
   ;ebene1
   For y = 0 To 20
      For x = 0 To 20
         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,1)
      Next
   Next
   ;ebene2
   For y = 0 To 20
      For x = 0 To 20
         DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,2)
      Next
   Next
   If animframe > 2 Then animframe = 0
   
   DrawImage char(richtung),ppx-scrollx,ppy-scrolly ,animframe
   Rect px*16-scrollx,py*16-scrolly,16,16,0
   ;------------------
   .tastaturabfrage
   If KeyDown(200) Then oben()
   If KeyDown(208) Then unten()
   If KeyDown(203) Then links()
   If KeyDown(205) Then rechts()
   time = MilliSecs()
   Flip
Forever

Function oben()
   If map(px,py-1,2) = 57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=0
      scrolly = scrolly - 2
      ppy = ppy -2
      py =1+ (ppy+8) /16
   EndIf
End Function

Function unten()
   If map(px,py+1,2) = 57Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=2
      scrolly = scrolly + 2
      ppy = ppy +2
      py =1+ (ppy+8) /16
   End If
End Function

Function rechts()
   If map(px+1,py,2) =57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=1
      scrollx = scrollx + 2
      ppx = ppx +2
      px =1+ (ppx-8) /16
   End If
End Function

Function links()
   If map(px-1,py,2) =57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=3
      scrollx = scrollx - 2
      ppx = ppx -2
      px = 1+(ppx-8) /16
   End If
End Function
between angels and insects

nagl

BeitragMo, Aug 09, 2004 12:02
Antworten mit Zitat
Benutzer-Profile anzeigen
kk,
ja so in etwa wollte ich das ^^...
jan, jetzt nur noch dein code verstehen...dann hab ich heute nen meilenstein geschafft ^^^...
kannst mir noch die frage beantworten:
is das ne gängige methode oder eher lame?
ich meine mit den ebenen...muss ich z.b in der 2. ebene, wo ich ja die objekte mache, bei allen anderen wo NICHTS ist, einen transparenten tile angeben (57,57) oder gibts da was einfacheres Wink würd mich freuen wenn du deine meinung dazu sagst Wink
... wie stellt man die bewegungsgeschwindigkeit ein..muss man das mitm timer machen? (is mir grad so eingefallen)

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 12:06
Antworten mit Zitat
Benutzer-Profile anzeigen
hm, die
Steuerung = Lame
Laden der Map = lame
animation = Gut
Darstellen der Map = lame
Codestyle = naja, hat potenzial

Ich werde mal die Map anzeige engine schnell umprogen, und dann senden!
between angels and insects

nagl

BeitragMo, Aug 09, 2004 12:09
Antworten mit Zitat
Benutzer-Profile anzeigen
Laughing ...also deine beurteilung find ich goil...lame lame ^^
machts mir doch relativ deutlich: /me noob!!!!
egal,
könntest mir erklären warum
...wüsste nich was man anders machen sollte..àla steuerung..mapladen und darstellung ...
aber alles in allem..thx für deine hilfe..echt kewl von dir
cu nagl

Jan_

Ehemaliger Admin

BeitragMo, Aug 09, 2004 12:17
Antworten mit Zitat
Benutzer-Profile anzeigen
hiho

ich wollte nicht lügen.

Ganz so N00big bist du garnicht, fast BB forums durchschnitt ich wollte blos damit sagen, das man eigentlich nüx so lassen kann.

Steuerung:
1. Benutzte nicht für jede richtung eine andere Function
2. PX,PY lassen, PPX und PPY löschen und 2 Variablen einfügen, die angeben, wieviele Pixel der Spieler von Px,Py gegangen ist, wenn die > 8 oder <8 sind, PX/PY ändern.
3. Player nach Zeit, nicht nach frames bewegen!

Mapladen:
auf jeden fall aus datei
dann, gleich mit 1n mal (schaue das Beispiel unten)

Darstellen der Map:
-mit 1n mal (siehe beispiel unten)
-nur sichtbaren bereich darstellen

Codestyle:
benutzte die Tab taste
- mit ; Komentare an den Quelltext schreiben

Beispiel, um dich auf einen besseren weg, der Map darstellung zu bringen:

Code: [AUSKLAPPEN]
Graphics 320,240,24,2

Dim char(3)
char(0) = LoadAnimImage("grakas/char.png",24,32,0,3)
char(1) = LoadAnimImage("grakas/char.png",24,32,12,3)
char(2) = LoadAnimImage("grakas/char.png",24,32,24,3)
char(3) = LoadAnimImage("grakas/char.png",24,32,36,3)

For n = 0 To 3
MaskImage char(n), 32,156,0
Next

Global tileset = LoadAnimImage("grakas/wald1.png",16,16,0,480)
MaskImage tileset, 0,117,117
Global ppx = 5*32 ;X-Position des Charackters
Global ppy = 3*32 ;Y-Position des Charackters
Global py = 7 ;Kollisions X-Position des Charackters
Global px = 10 ;Kollisions Y-Position des Charackters
Global scrolly ;Die Variable für die ScrollY-Position
Global scrollx ;Die Variable für die ScrollX-Position

Global time,animtime,animframe,richtung

Dim map(20,20,1)


.LVL1
Data 77,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77  ,77 ;77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,77
Data 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77

Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,58,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,358,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,58,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,358,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,479
Data 479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479,479

Restore LVL1
For layer = 0 To 1 ; 2 Layer
   For y = 0 To 20
      For x = 0 To 20
         Read map(x,y,layer)
      Next
   Next
Next

SetBuffer BackBuffer()
Color 255,0,0
Repeat
   Cls
   If KeyDown(1) Then End
      
   For layer = 0 To 1; print 2 layers
      For y = 0 To 20
         For x = 0 To 20
            If map(x,y,layer) <> 57 Then DrawImage tileset,x*16-scrollx,y*16-scrolly,map(x,y,layer)
         Next
      Next
   Next
   If animframe > 2 Then animframe = 0
   
   DrawImage char(richtung),ppx-scrollx,ppy-scrolly ,animframe
   Rect px*16-scrollx,py*16-scrolly,16,16,0
   ;------------------
   .tastaturabfrage
   If KeyDown(200) Then oben()
   If KeyDown(208) Then unten()
   If KeyDown(203) Then links()
   If KeyDown(205) Then rechts()
   time = MilliSecs()
   Flip
Forever

Function oben()
   If map(px,py-1,1) = 57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=0
      scrolly = scrolly - 2
      ppy = ppy -2
      py =1+ (ppy+8) /16
   EndIf
End Function

Function unten()
   If map(px,py+1,1) = 57Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=2
      scrolly = scrolly + 2
      ppy = ppy +2
      py =1+ (ppy+8) /16
   End If
End Function

Function rechts()
   If map(px+1,py,1) =57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=1
      scrollx = scrollx + 2
      ppx = ppx +2
      px =1+ (ppx-8) /16
   End If
End Function

Function links()
   If map(px-1,py,1) =57 Then
      If time -200 > animtime Then
         animtime = MilliSecs()
         animframe = animframe +1
      EndIf
      richtung=3
      scrollx = scrollx - 2
      ppx = ppx -2
      px = 1+(ppx-8) /16
   End If
End Function
between angels and insects

nagl

BeitragMo, Aug 09, 2004 12:28
Antworten mit Zitat
Benutzer-Profile anzeigen
thx jan...
joar das mapladen kommt noch..is ja eig. erstmal dazu da um zu sehen ob das so ging mit 2 ebenen etc...das andre kommt jetzt
so das wird ,glaub ich, der letzte thread ...
thx 4 ur help
cu nagl

Chester

BeitragDi, Aug 10, 2004 15:49
Antworten mit Zitat
Benutzer-Profile anzeigen
omg

brezelbakery

BeitragDi, Aug 10, 2004 20:58
Antworten mit Zitat
Benutzer-Profile anzeigen
ChEsTeR hat Folgendes geschrieben:
omg

ich frag mich was das soll oO

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group