problem mit if
Übersicht

gigiBetreff: problem mit if |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 800,600
SetBuffer BackBuffer() AppTitle"Züchterspiel" s=MouseX() Palme=LoadMesh("Palme.3ds") MoveEntity Palme,0,-8,20 drache=LoadMesh("Rache.3ds") MoveEntity drache,0,-2,8 EntityType drache,1 EntityRadius drache ,5 level=LoadMesh("level.3ds") MoveEntity level,0,-8,0 EntityColor level,0,70,50 EntityType level,2 unzen=40 tiger1=1 cam=CreateCamera(drache) PositionEntity cam,0,-2.5,0 CameraClsColor cam,0,100,255 Landen=0 s=1 d=0 p=0 While Not KeyHit(1) If KeyDown(200)Then MoveEntity drache,0,0,0.5 If KeyDown(208)Then MoveEntity drache,0,0,-0.5 If KeyDown(205)Then TurnEntity drache,0,-2,0 If KeyDown(203)Then TurnEntity drache,0,2,0 If KeyHit(15) Then s=s-1 d=d-1 p=p-1 MoveEntity drache,0,0,0 If KeyDown(42) Then MoveEntity drache,0,0.1,0 If KeyDown(29) Then MoveEntity drache,0,-0.1,0 Collisions 1,2,2,2 UpdateWorld RenderWorld If KeyDown(57) Then Text 100,100,"Kaufen" was=Input() If was=pferd Then unzen=unzen-2 so=CountCollisions(drache) Print so Text 700,550, unzen+" Unzen" Flip Wend das is mein code.wenn ich jetzt noch hinzufüge: Code: [AUSKLAPPEN] if d=0 then freeentity drache
existiert drache plötzlich nich mehr... wo is der fehler? ![]() das code funkt nich... |
||
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Naja offensichtlich ist d=0 und du hast ja gesagt wenn d=0 ist, dann soll das entity "drache" gelöscht werden. Also ... ? Ist doch eigentlich logisch dass der drache dann verschwindet oder? | ||
gigiBetreff: stimmt er hat aber recht |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
danke für offensichtliche, jedoch unentdeckte lösung.(du hast sie schon endeckt.)
aber es soll ja auch so sein das der drache erst nicht sichtbar ist. und erst bei kaufen erscheint.wie denn dann das? |
||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
edit:
ne moment mach hideentiy und showentity andstatt freentity umschalten zwischen sichtbar und nicht sichtbar mit d=1-d und dann noch sowas wie Code: [AUSKLAPPEN] if keyhit (XX)
d=1-d select d case 0 hideentity drache case 1 showentity drache end select endif |
||
gigiBetreff: das sollte bestimmt funktionieren. |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Nur habe ich jetzt bei collions die meldung exepting wend | ||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
dann hast du ein endif zuviel oder zuwenig | ||
gigiBetreff: noch ne meldung... |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
jetzt gibt er noch die meldung exepting end of file auch bei collisions
dann mache ich n komma aber nochma das gleiche |
||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
gigiBetreff: noch ne meldung... |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
jetzt gibt er noch die meldung exepting end of file auch bei collisions
dann mache ich n komma aber nochma das gleiche ops das war einer zuviel(bin ausversehen auf zurück gekommen!) |
||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Zeig doch nochmal den Code | ||
gigiBetreff: hier |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 800,600
SetBuffer BackBuffer() AppTitle"Züchterspiel" s=MouseX() Palme=LoadMesh("Palme.3ds") MoveEntity Palme,0,-8,20 drache=LoadMesh("Rache.3ds") MoveEntity drache,0,-2,8 EntityType drache,1 EntityRadius drache ,5 level=LoadMesh("tempel.3ds") MoveEntity level,0,-8,0 EntityColor level,0,70,50 EntityType level,2 unzen=40 tiger1=1 cam=CreateCamera(drache) PositionEntity cam,0,-2.5,0 CameraClsColor cam,0,100,255 Landen=0 so=Collisions 1,2,2,2 While Not KeyHit(1) If KeyDown(200)Then MoveEntity drache,0,0,0.5 If KeyDown(208)Then MoveEntity drache,0,0,-0.5 If KeyDown(205)Then TurnEntity drache,0,-2,0 If KeyDown(203)Then TurnEntity drache,0,2,0 If KeyDown(42) Then MoveEntity drache,0,0.1,0 If KeyDown(29) Then MoveEntity drache,0,-0.1,0 If KeyHit(15) Then d=1-d Select d Case 0 HideEntity drache Case 1 ShowEntity drache End Select End If UpdateWorld RenderWorld If KeyDown(57) Then Text 100,100,"Kaufen" was=Input() If was=pferd Then unzen=unzen-2 so=CountCollisions(drache) Print co Text 700,550, unzen+" Unzen" Flip Wend |
||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Rücke Deinen Code vernünftig ein, mach immer Nur einen Befehl pro Zeile und schliesse dann deine Ifs mit Endif ab und das Problem wird verschwinden. | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
gigiBetreff: klappt nich und nochma code |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 800,600
SetBuffer BackBuffer() AppTitle"Züchterspiel" s=MouseX() Palme=LoadMesh("Palme.3ds") MoveEntity Palme,0,-8,20 drache=LoadMesh("Rache.3ds") MoveEntity drache,0,-2,8 EntityType drache,1 EntityRadius drache ,5 level=LoadMesh("tempel.3ds") MoveEntity level,0,-8,0 EntityColor level,0,70,50 EntityType level,2 unzen=40 tiger1=1 cam=CreateCamera(drache) PositionEntity cam,0,-2.5,0 CameraClsColor cam,0,100,255 Landen=0 so=Collisions 1,2,2,2 While Not KeyHit(1) If KeyDown(200)Then MoveEntity drache,0,0,0.5 EndIf If KeyDown(208)Then MoveEntity drache,0,0,-0.5 EndIf If KeyDown(205)Then TurnEntity drache,0,-2,0 EndIf If KeyDown(203)Then TurnEntity drache,0,2,0 EndIf If KeyDown(42) Then MoveEntity drache,0,0.1,0 EndIf If KeyDown(29) Then MoveEntity drache,0,-0.1,0 EndIf If KeyHit(15) Then d=1-d Select d Case 0 HideEntity drache Case 1 ShowEntity drache End Select EndIf UpdateWorld RenderWorld If KeyDown(57) Then Text 100,100,"Kaufen" was=Input() If was=pferd Then unzen=unzen-2 so=CountCollisions(drache) Print co Text 700,550, unzen+" Unzen" Flip Wend |
||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ok
anstatt so=Collisions[...] schreib nur Collisions[...] und hinter if keyhit(15) muss das "then" weg |
||
![]() |
aMulSieger des Minimalist Compo 01/13 |
![]() Antworten mit Zitat ![]() |
---|---|---|
coldie hat Folgendes geschrieben: hinter if keyhit(15) muss das "then" weg
Falsch. Das 'EndIf' muss in die nächste Zeile ![]() Und der ganze Select-Block gehört auch nicht in nur eine... EDIT: Ach, und nimm das Input aus der Schleife(oder am besten gleich die ganze Zeile...) Und noch ein ganz allgemeiner Tipp: Programmiere erst mal was in 2D, ja? Damit du wenigstens weißt wie 'If' funktioniert... |
||
Panic Pong - ultimate action mashup of Pong and Breakout <= aktives Spiele-Projekt, Downloads mit vielen bunten Farben!
advASCIIdraw - the advanced ASCII art program <= aktives nicht-Spiele-Projekt, must-have für ASCII/roguelike/dungeon-crawler fans! Alter BB-Kram: ThroughTheAsteroidBelt - mit Quelltext! | RGB-Palette in 32²-Textur / Farbige Beleuchtung mit Dot3 | Stereoskopie in Blitz3D | Teleport-Animation Screensaver |
coldie |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
aMul hat Folgendes geschrieben: coldie hat Folgendes geschrieben:
hinter if keyhit(15) muss das "then" weg
Falsch. Das 'EndIf' muss in die nächste Zeile ![]() Was meinst du mit "in die nächste Zeile"? Doch wohl nicht hinter UpdateWorld oder? |
||
![]() |
FreetimeCoder |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] While Not KeyHit(1)
If KeyDown(200)Then MoveEntity drache,0,0,0.5 EndIf If KeyDown(208)Then MoveEntity drache,0,0,-0.5 EndIf If KeyDown(205)Then TurnEntity drache,0,-2,0 EndIf If KeyDown(203)Then TurnEntity drache,0,2,0 EndIf If KeyDown(42) Then MoveEntity drache,0,0.1,0 EndIf If KeyDown(29) Then MoveEntity drache,0,-0.1,0 EndIf If KeyHit(15) Then d=1-d Select d Case 0 HideEntity drache Case 1 ShowEntity drache End Select EndIf UpdateWorld RenderWorld If KeyDown(57) Then Text 100,100,"Kaufen" was=Input() If was=pferd Then unzen=unzen-2 so=CountCollisions(drache) Print co EndIf ;DAS hat gefehlt EndIf ;Und das auch! Text 700,550, unzen+" Unzen" Flip Wend Wenn man ordentlich einrückt, sieht man den Fehler sofort ![]() |
||
"Wir haben keine Chance, aber wir werden sie nutzen!"
Projekte: Dexterity Ball (100%) Aquatic Atmosfear (22 % ca 4700 Zeilen) eingefrohren mangels OOP Fähigkeiten von Blitz (ehemals Uboot) PC: Intel D 3 GHz | NVidiaGforce 6700 256 Mb | 1024 Mb DDR RAM 400 Mhz | 2x160 GB S-ATA |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group