WortChaosV1
Übersicht BlitzMax, BlitzMax NG Codearchiv & Module
Suco-XBetreff: WortChaosV1 |
Di, Jun 07, 2005 16:26 Antworten mit Zitat |
|
---|---|---|
Servus
Heute Nacht konnte ich wieder mal nicht so knusper schlafen und bei dem Schwachsinnigen Sat 1 Nacht Quiz ist mir die Idee gekommen, da ein wenig abzukupfern. Bei WortChaosV1 werden Wörter genommen und die Buchstaben gemischt auf Karten verteilt. Der Spieler muss das Wort via Drag & Drop der Karten wieder unten zusammensetzen. Beim Nacht Quiz war das ganze etwas zu einfach, bei ist es vielleicht etwas zu schwer Ich garantiere mindestens 1 Minute Spielspaß und einen halbwegs ansehnlichen Code. Für Leute ohne Bmax.. http://www.sucox.art-fx.org/Bl...haosv1.exe Wichtig:Würde mich freuen wenn jemand der Linux/Mac besitzt, diesen Code dort mal ausführt und sagt ob er ohne änderungen funktioniert. Code: [AUSKLAPPEN] Rem ******************** WortChaosV1 © 2005 by Suco-X *********************** Code: Suco-X Grafik: Suco-X Sound: Suco-X Spielanleitung: Jedes Wort wird zufaellig gemischt und der Spieler muss das Wort wieder zusammensetzen. Oben die Karten mit den Buchstaben koennen mit der Maus ansvisiert und dann unten auf die weissen Felder gezogen werden. Wenn das Wort komplett und richtig zusammngefuegt wurde, wechselt der Spieler ins naechste Level. Es gibt 3 Levels a 6 Woerter Alle Inhalte dieses Codes duerfen frei verwendet werden. Mfg Suco-X ************************************************************************** End Rem Strict Framework brl.glmax2d Import brl.random ?Win32 Import pub.win32 ? TEntity.ObjectList = New TList Type TEntity Global ObjectList:TList Field ListLink:TLink Field x:Float, y:Float Field Width:Float=32, Height:Float=32 Field OrderZ:Int Method New() self.ListLink = self.ObjectList.AddLast(Self) self.ObjectList.Sort() End Method Function Idle() For Local TempObject:TEntity = EachIn self.ObjectList TempObject.Update() TempObject.Render() Next End Function Method Compare(OtherObject:Object) Local TempObject:TEntity = TEntity(OtherObject) If Not TempObject Return 1 EndIf Return self.OrderZ - TempObject.OrderZ End Method Method Update() Abstract Method Render() Abstract End Type Type TKarte Extends TEntity Field Ascii:Int Field TextScale:Float Field OffsetX:Float, OffsetY:Float Field MouseOver:Int, Locked:Int Function GetInstance:TKarte(x:Float, y:Float, ascii:Int) Local TempObject:TKarte = New TKarte TempObject.x = x TempObject.y = y TempObject.OrderZ = 1 TempObject.TextScale = 2.0 TempObject.ascii = ascii Return TempObject End Function Method IsLocked() For Local TempObject:TKarte = EachIn self.ObjectList If TempObject =Self Continue EndIf If TempObject.Locked = True Return True EndIf Next Return False End Method Method SlotCollide() For Local TempObject:TSlot = EachIn self.ObjectList If RectsCollide(self.x, self.y, self.width, self.height, TempObject.x, TempObject.y, TempObject.Width, TempObject.Height) TempObject.GetCard(Self) EndIf Next End Method Method Update() If self.IsLocked() = True Return EndIf Local LeftDown = MouseDown(1) If LeftDown = True If self.Locked= True self.x = MouseX()-self.OffsetX self.y = MouseY()-self.OffsetY Return EndIf ElseIf LeftDown = False If self.Locked = True self.SlotCollide() EndIf EndIf self.Locked = False self.MouseOver = RectsCollide(MouseX(),MouseY(), 1, 1, self.x, self.y, self.width, self.height) If self.MouseOver = True If LeftDown = True self.Locked = True self.OffsetX = MouseX()-self.x self.OffsetY = MouseY()-self.y EndIf EndIf End Method Method Render() Local Text:String = Chr(self.ascii) Local TxtWidth:Float = (TextWidth(text)*self.TextScale) Local TxtHeight:Float = (TextHeight(text)*self.TextScale) Local TextX:Float = (self.x+self.width/2)-(TxtWidth/2) Local TextY:Float = (self.y+self.height/2)-(TxtHeight/2) ResetStates() SetColor 166,198,151 DrawRect self.x, self.y, self.width, self.height ResetStates() SetColor 128,0,0 SetScale self.TextScale, self.TextScale DrawText Text, TextX, TExtY ResetStates() SetLineWidth 3 SetColor 250,250,250 DrawLine self.x, self.y,self.x,self.y+self.width SetColor 200,200,200 DrawLine self.x, self.y, self.x+self.width, self.y SetColor 100,100,100 DrawLine self.x+self.width, self.y, self.x+self.width,self.y+self.height SetColor 50,50,50 DrawLine self.x+self.width, self.y+self.height,self.x, self.y+self.height SetLineWidth 1 End Method End Type Type TSlot Extends TEntity Field Parent:TKarte Function GetInstance:TSlot(x:Float, y:Float) Local TempObject:TSlot = New TSlot TempObject.OrderZ = 0 TempObject.x = x TempObject.y = y Return TempObject End Function Method GetCard(Karte:TKarte) If self.Parent<>Null self.Parent.x = self.x self.Parent.y = self.y-(self.width*2) ?Win32 beep(250,100) ? EndIf self.Parent = Karte self.Parent.x = self.x self.Parent.y = self.y ?Win32 beep(500,50) ? End Method Method Update() If self.Parent=Null Return EndIf If RectsCollide(self.x, self.y, self.width, self.height, self.Parent.x, self.Parent.y, self.Parent.Width, self.Parent.Height) = False self.Parent = Null EndIf End Method Method Render() ResetStates() DrawRect self.x, self.y, self.width, self.height ResetStates() SetLineWidth 3 SetColor 50,50,50 DrawLine self.x, self.y,self.x,self.y+self.width SetColor 100,100,100 DrawLine self.x, self.y, self.x+self.width, self.y SetColor 200,200,200 DrawLine self.x+self.width, self.y, self.x+self.width,self.y+self.height SetColor 250,250,250 DrawLine self.x+self.width, self.y+self.height,self.x, self.y+self.height SetLineWidth 1 End Method End Type Graphics 1024,768,32,60 SeedRnd(MilliSecs()) Global GameWord:String[3,6] Global CurrentWord:String Global Level:Int = 0 ,WordIndex:Int = 0, OldIndex:Int = -1 GameWord[0,0] = "HALLO" GameWord[0,1] = "TOPF" GameWord[0,2] = "VASE" GameWord[0,3] = "AUTO" GameWord[0,4] = "TANTE" GameWord[0,5] = "NIEMAND" GameWord[1,0] = "TOPFBLUME" GameWord[1,1] = "INTELLIGENZ" GameWord[1,2] = "FAHRRAD" GameWord[1,3] = "BEGEISTERT" GameWord[1,4] = "SONDERBAR" GameWord[1,5] = "SUCOX" GameWord[2,0] = "ABRISSBIRNE" GameWord[2,1] = "SCHAUFELBAGGER" GameWord[2,2] = "UNTERBEWUSSTSEIN" GameWord[2,3] = "FALLSCHIRMSPRINGEN" GameWord[2,4] = "ROCKKONZERT" GameWord[2,5] = "SCHIZOPHRENIE" SetClsColor 128,128,128 Repeat Cls If OldIndex<>WordIndex If WordIndex=>6 Level:+1 OldIndex = -1 WordIndex = 0 ?Win32 beep(20,300) beep(200,150) ? If Level = 3 GameFinale() Exit EndIf Else OldIndex = WordIndex EndIf SetWord() EndIf Local TempWort:String = "" For Local TempObject:TSlot = EachIn TEntity.ObjectList If TempObject.Parent = Null Continue EndIf TempWort:+Chr(TempObject.Parent.Ascii) Next If TempWort = CurrentWord ?Win32 For Local i:Int = 0 Until 20 beep((i+Rand(4,10))*20,(20+Rand(50,100))) Next beep(2000,1000) ? WordIndex:+1 EndIf TEntity.Idle() ResetStates() SetColor 50,50,128 DrawText "LEVEL: "+(Level+1),10,10 DrawText "Wort "+(WordIndex+1)+" von 6",10,30 SetScale 1.8,1.8 SetColor 128,0,0 DrawText "Eingabe: ",2,GraphicsHeight()-256 Flip FlushMem() Until KeyHit(KEY_ESCAPE) End Function GameFinale() Local Text:String = "YOU HAVE WON" Local TxtScale:Float = 5.0 Local TxtWidth:Float = TextWidth(Text)*TxtScale Local TxtHeight:Float = TextHeight(Text)*TxtScale Local TxtX:Float = (GraphicsWidth()/2)-(TxtWidth/2) Local TxtY:Float = (GraphicsHeight()/2)-(TxtHeight/2) FlushKeys() Repeat Cls ResetStates() SetScale TxtScale,TxtScale SetColor 128,0,0 For Local x:Int = -4 To 4 For Local y:Int = -4 To 4 DrawText Text,TxtX+x, TxtY+y Next Next SetColor 255,255,255 DrawText Text,TxtX, TxtY Flip FlushMem() Until GetChar()<>0 End Function Function SetWord() CurrentWord = GameWord[Level,WordIndex] TEntity.ObjectList.Clear() Local CheckArray:Int[CurrentWord.length] Local x:Int = 0, y:Int = 0 Repeat Local TempIndex:Int = Rand(0,CurrentWord.length-1) If CheckArray[TempIndex] = 0 CheckArray[TempIndex] = 1 TKarte.GetInstance(256+(x*64), 64+(y*64), CurrentWord[TempIndex]) x:+1 If x=>(CurrentWord.length/2) x = 0 y:+1 EndIf EndIf Local Ready:Int = 0 For Local i:Int = 0 Until CheckArray.length If CheckArray[i] = 1 Ready:+1 EndIf Next If Ready = CheckArray.length Exit EndIf Forever For Local i:Int = 0 Until CurrentWord.length TSlot.GetInstance(128+(i*40),GraphicsHeight()-256) Next End Function Function ResetStates() SetAlpha 1.0 SetRotation 0.0 SetScale 1.0,1.0 SetColor 255,255,255 SetBlend MASKBLEND End Function Function RectsCollide(x1:Float,y1:Float,width1:Float,height1:Float,.. x2:Float,y2:Float,width2:Float,height2:Float) If x1+width1=>x2 And x1<x2+width2 If y1+height1=>y2 And y1<y2+height2 Return True EndIf EndIf Return False End Function |
||
Intel Core 2 Quad Q8300, 4× 2500 MHz, 4096 MB DDR2-Ram, GeForce 9600GT 512 MB |
rema |
Di, Jun 07, 2005 19:02 Antworten mit Zitat |
|
---|---|---|
Läuft super ohne Änderung !!! Coole Idee. Nur aufpassen das sie kein Geld für ihre Spielidee dir abzapfen wollen!!! | ||
bruZard |
Di, Jun 07, 2005 19:09 Antworten mit Zitat |
|
---|---|---|
Sehr cool Suco-X ... vor allem der Code zeigt mir Sachen die ich noch nicht kannte
*thumbs up* ... *pics auch* |
||
PIV 2,4GHz - 1GB DDR 333 - ATI Radeon9600 - WinXP - DX9.0c - BMax 1.14 - B3D 1.91 - 1280x1024x32
User posted image |
Suco-XBetreff: .... |
Di, Jun 07, 2005 19:31 Antworten mit Zitat |
|
---|---|---|
Danke
Ich schätze mal sie werden wegen so einem Simplen Spielprinzip wohl keine Klage einreichen 8) @Rema : Linux oder Mac? Mfg Suco |
||
Intel Core 2 Quad Q8300, 4× 2500 MHz, 4096 MB DDR2-Ram, GeForce 9600GT 512 MB |
remaBetreff: Re: .... |
Di, Jun 07, 2005 19:38 Antworten mit Zitat |
|
---|---|---|
Suco-X hat Folgendes geschrieben: @Rema : Linux oder Mac?
Mfg Suco Sorry, natürlich Linux. |
||
Übersicht BlitzMax, BlitzMax NG Codearchiv & Module
Powered by phpBB © 2001 - 2006, phpBB Group