Types
Übersicht

GeGenesisBetreff: Types |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich habe vor eine aufbau simulatation zu machen aber
wieso klappnen die types nicht? Code: [AUSKLAPPEN] Function button(id,mx1,my1,x1,y1,x2,y2)
If MouseHit(1) And mx1>x1 And mx1<x2 And my1>y1 And my1<y2 ret=id EndIf Return ret End Function Graphics 800,600,32,2 Type feld Field Typ$ Field x Field y End Type Local ar.feld Local geb.feld geb.feld=New feld geb\typ$="Haus" Repeat SetBuffer BackBuffer() Cls mx=MouseX() my=MouseY() Color(100,100,255) Rect 0,500,800,100 Color(0,255,0) Rect 10,510,50,50 Rect 70,510,50,50 id=button(1,mx,my,10,510,60,560) If id=1 Print("TYP=Haus") typ2$="Haus" EndIf id=button(2,mx,my,70,510,130,560) If id=2 Print("TYP=Farm") typ2$="Farm" EndIf id=button(3,mx,my,0,0,800,500) If id=3 geb=New feld geb\typ$=typ2$ geb\x=mx geb\y=my EndIf For geb=Each feld sx=geb\x sy=geb\y Plot sx,sy Next Text 10,10,"TYP:"+typ2$+" ID:"+id Flip Until KeyHit(1) Mann sieht das bei id 3 das erstellen der types ist aber wieso klappt das nicht ? |
||
![]() |
simi |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
MosueHit(1) gibt nur das erste mal etwas zurück, das 2. mal immer nur 0. Du musst also MouseHit am Anfang speichern, und dann aus der Variable herausabfragen, wie z.B. die Mauskordinaten.... cu simi |
||
GeGenesis |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Jetzt gibt es aber Problem mit der Images ...
Er läd sie zwar aber zeigt sie nicht an ... Code: [AUSKLAPPEN] Function button(id,mx1,my1,x1,y1,x2,y2)
mh=MouseDown(1) If mh=1 And mx1>x1 And mx1<x2 And my1>y1 And my1<y2 ret=id EndIf Return ret End Function test=LoadImage("test.bmp") If test=0 Then Print "gfx\Haus.bmp konnte nicht geladen werden!":WaitKey() Graphics 800,600,32,2 Type feld Field Typ$ Field x Field y End Type Local ar.feld Local geb.feld geb.feld=New feld geb\typ$="Haus" Repeat SetBuffer BackBuffer() Cls mx=MouseX() my=MouseY() Color(100,100,255) Rect 0,500,800,100 Color(0,255,0) DrawImage test,10,510 Rect 10,510,50,50 id=button(1,mx,my,10,510,85,5850) If id=1 Print("TYP=Haus") typ2$="Haus" EndIf If MouseHit(1) geb=New feld geb\typ$=typ2$ geb\x=mx geb\y=my EndIf For geb=Each feld t$=geb\typ$ sx=geb\x sy=geb\y If t$="Haus" ;DrawImage haus,sx,sy EndIf Next Text 10,10,"TYP:"+typ2$+" ID:"+id Flip Until KeyHit(1) |
||
![]() |
simi |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] DrawImage test,10,510 Rect 10,510,50,50 Also, du zeichnest das Bild und zeichnest dann das Rechteck darüber.... ![]() ![]() |
||
GeGenesis |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ja habe ich aber rschon bemerkt | ||
![]() |
Blatolo |
![]() Antworten mit Zitat ![]() |
---|---|---|
Nachdem du die Grafik lädst setzt du erst graphics was alle bilder im speicher löscht. | ||
![]() |
Hubsi |
![]() Antworten mit Zitat ![]() |
---|---|---|
SetBuffer hat in der Schleife auch nichts zu suchen ![]() |
||
Den ganzen Doag im Bett umanandflagga und iaz daherkema und meine Hendl`n fressn... |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group