objekt löschen???
Übersicht

![]() |
Mathias-KwiatkowskiBetreff: objekt löschen??? |
![]() Antworten mit Zitat ![]() |
---|---|---|
ein mesh löschen wie funktioniert soetwas?
Code: [AUSKLAPPEN] Graphics3D 1024,768,32,1
Global objekt.objekt Type objekt Field x# Field y# Field z# Field haus End Type SetBuffer BackBuffer() camera = CreateCamera() PositionEntity camera, 500, 10, 500 RotateEntity camera, 45, 0, 0 light = CreateLight() RotateEntity light, 90, 0, 0 terrain = CreateTerrain(512) EntityPickMode terrain , 2 drum = LoadMesh("haus_000.3ds") EntityPickMode drum , 2 EntityType drum , 2 grass_tex = LoadTexture("mossyground.bmp") EntityTexture terrain,grass_tex While Not KeyHit(1) Collisions 1, 2, 2, 2 RenderWorld mx = MouseX() my = MouseY() entity = CameraPick(camera, mx, my) RenderWorld If entity = 0 Then Text 0, 0, "Nicht ausgewählt" If entity<>0 Then Text 0, 0, "Ausgewählt:" + entity Text 0, 20, "X:" + PickedX() Text 0, 40, "Y:" + PickedY() Text 0, 60, "Z:" + PickedZ() Text 0, 100, "Benutze Cursortasten..." Text 0, 120, "X Position: " + EntityX#(camera) Text 0, 140, "Y Position: " + EntityY#(camera) Text 0, 160, "Z Position: " + EntityZ#(camera) anzahl=0 For objekt.objekt= Each objekt anzahl=anzahl+1 Next Text 0, 200, "Anzahl: " + anzahl ;######################################################################### ;# # ;# Wenn man mit maustaste 2 draufklickt mesh löschen # ;# # ;######################################################################### For objekt.objekt= Each objekt If entity=objekt\haus Then EntityColor objekt\haus,0,255,0 If MouseHit(2) Then Delete objekt.objekt EndIf Else EntityColor objekt\haus,255,255,255 EndIf Next ;######################################################################### ;# # ;# neues gebäude hinzufügen # ;# # ;######################################################################### If MouseHit(1) Then objekt= New objekt objekt\x# = PickedX() objekt\y# = .5 objekt\z# = PickedZ() objekt\haus= LoadMesh("haus_000.3ds") EntityPickMode objekt\haus, 2 PositionEntity objekt\haus,PickedX(),.5,PickedZ() EndIf EndIf Oval mx - 5, my - 5, 10, 10, 1 ;######################################################################### ;# # ;# Am Bildschirmrand die Maus Bewegen # ;# # ;######################################################################### If MouseX()>-15 And MouseX()<1024 And MouseY()>-15 And MouseY()<15 Then MoveEntity camera, 0, +0.05, 0.05 If MouseX()>-15 And MouseX()<1024 And MouseY()>768-15 And MouseY()<768 Then MoveEntity camera, 0, -0.05, -0.05 If MouseX()>-15 And MouseX()<15 And MouseY()>-15 And MouseY()<768 Then MoveEntity camera, -0.05,0,0 If MouseX()>1024-15 And MouseX()<1024+15 And MouseY()>-15 And MouseY()<768 Then MoveEntity camera, +0.05,0,0 ;######################################################################### ;# # ;# Kamera hoch und runter # ;# # ;######################################################################### If KeyDown(200) = 1 Then MoveEntity camera, 0,.5, 0 If KeyDown(208) = 1 Then MoveEntity camera, 0, -.5,0 If KeyDown(203) = 1 Then TurnEntity camera, 0, 1, 1 If KeyDown(205) = 1 Then TurnEntity camera, 0, -1, -1 If EntityY(camera)<8 Then MoveEntity camera, 0,0.5, 0 If EntityY(camera)>30 Then MoveEntity camera, 0,-0.5, 0 If EntityX(camera)<0 Then MoveEntity camera, 0.05,0,0 If EntityX(camera)>512 Then PositionEntity camera, 512, EntityY#(camera), EntityZ#(camera) If EntityZ(camera)<0 Then PositionEntity camera, EntityX#(camera), EntityY#(camera), 0 If EntityZ(camera)>512 Then PositionEntity camera, EntityX#(camera), EntityY#(camera), 512 Flip Wend End im code steht beschrieben, bei maustaste=2 soll das haus von der bildfläche verschwinden, nur wie, also der type wird gelöscht nur das haus ansich nicht |
||
![]() |
Chester |
![]() Antworten mit Zitat ![]() |
---|---|---|
FreeEntity![]() |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group