Spiel wie Bejeweled: Types in Array
Übersicht

The ForswornBetreff: Spiel wie Bejeweled: Types in Array |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Titel sagt alles...
Code: [AUSKLAPPEN] Local x=10,y=10 Local my_array[x,y] For x=0 to 9 For y=0 to 9 a:bla = New bla my_array[x,y] = a Next Next Type bla Field Farbe$ Field soll_x Field soll_y Field Status End Type Ich hab ein Spielfeld mit 10x10 Flächen. Nun will ich in jedem Feld einen Stein, dieser soll die Eigenschaften von bla haben. Aber wie "füll" ich die nun? Und wie spreche ich die nachher an?? my_array[x,y].Farbe geht ja wohl kaum.... Danke für eure Hilfe |
||
![]() |
d-bug |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] Local x=10,y=10 Local my_array:bla[x,y] '<------------ Objecttyp angeben For x=0 to 9 For y=0 to 9 a:bla = New bla my_array[x,y] = a Next Next Type bla Field Farbe$ Field soll_x Field soll_y Field Status End Type Dann geht auch Code: [AUSKLAPPEN] my_array[x,y].Farbe
|
||
The Forsworn |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Genial!!!
![]() Danke! ![]() Lasst das hier bitte mal noch offen, falls noch Fragen kommen^^ Ist nämlich mein erstes Projekt mit BM. ![]() |
||
The Forsworn |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
https://www.blitzforum.de/help/String
Wie mache ich so etwas in BM? Danke schonmal^^ |
||
ChristianK |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Code: [AUSKLAPPEN] Function StringKopieren:String( text:String, anzahl:Int )
Local s:String For Local i:Int = 1 To anzahl s = s + text Next Return s End Function Local bla:String = "Bla" Local neu:String = StringKopieren( bla, 5 ) Print neu |
||
AdvanceLcd
Intel Core 2 Duo 3.2 GHz, 4 GB RAM, GeForce 8800 GTX | MacBook Pro 15,4″ Intel Core 2 Duo 2.4 GHz, 2 GB RAM, GeForce 8600M GT |
The Forsworn |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ist aber umständlich, wenn ich es so machen will:
Code: [AUSKLAPPEN] For x = 0 To 9 ; For y = 0 To 9
Feld[x,y] = New egg Next ; Next Local temp% ; Local tempString$ .start For x = 0 To 9 ; For y = 0 To 9 Feld[x,y].Farbe = Rand (1,a) tempString$=String(Feld[x,y].Farbe,1)+String(Feld[x,y-1].Farbe,1)+String(Feld[x,y-2].Farbe,1) Select tempString$ Case "111","222","333","444","555","666","777","888","999","101010" Goto start End Select tempString$=String(Feld[x,y].Farbe,1)+String(Feld[x-1,y].Farbe,1)+String(Feld[x-2,y].Farbe,1) Select tempString$ Case "111","222","333","444","555","666","777","888","999","101010" Goto start End Select Next ; Next Edit: Warte mal kurz^^ Ich melde mich gleich wieder... edit2: Hab gerade gemerkt, dass man das 1:1 ersetzen kann... lol Jetzt mus ich nur ne Lösung für das goto finden... thx! Finaledit: Code: [AUSKLAPPEN] For x = 0 To 9; For y = 0 To 9
Feld[x,y] = New egg Next ; Next Local tempString$ For x = 0 To 9; For y = 0 To 9 Feld[x,y].Farbe = Rand (1,a) If y >= 2 tempString$=Stringkopieren(Feld[x,y].Farbe,1)+Stringkopieren(Feld[x,y-1].Farbe,1)+Stringkopieren(Feld[x,y-2].Farbe,1) Select tempString$ Case "111","222","333","444","555","666","777","888","999","101010" y=0 x= 0 End Select EndIf If x >= 2 tempString$=Stringkopieren(Feld[x,y].Farbe,1)+Stringkopieren(Feld[x-1,y].Farbe,1)+Stringkopieren(Feld[x-2,y].Farbe,1) Select tempString$ Case "111","222","333","444","555","666","777","888","999","101010" y= 0 x= 0 End Select EndIf Next ; Next Hab jetzt auch kein böses goto mehr^^ Danke!!! |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group