Schonwieder Types *gelöst*
Übersicht

![]() |
N0XBetreff: Schonwieder Types *gelöst* |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi!
Ich hab mir mal ein Spiel gebastelt wo Krümelmonster Kekse auffressen muss. Es gibt schon verschiedene Kekse, allerdings ist es so das es egal ist welchen Keks man grade gegessen hat, der aktuelle Counter wird immer einen runter gesetzt. Das soll aber nur sein wenn das entsprechende Level grade aktiv ist. Was mache ich falsch? Hier ein bisschen Code: Code: [AUSKLAPPEN] counter = 1
pcounter = 1 Global schirm_count=10,eat_1=0 Global schoko_count=20,eat_2=0 Global eaten_count=25,eat_3=0 Color 0,0,210 PlaySound(ch2) While Not KeyDown(1) WaitTimer(timer) counter = counter + 1 pcounter = pcounter + 1 If counter>60 Then c.cookie = New cookie c\x = Rnd(1,950) c\y = 0 If quest=1 Then c\speed = 2 c\gfx = cookie EndIf If quest=2 Then c\speed = 3 c\gfx = cookie2 EndIf If quest=3 Then c\speed = 4 c\gfx = cookie3 EndIf c\punkte = z counter = 0 EndIf If pcounter>240 Then p.pcookie = New pcookie p\x = Rnd(1,950) p\y = 0 If quest=1 Then p\speed=2 p\gfx = poison EndIf If quest=2 Then p\speed=3 p\gfx = poison2 EndIf If quest=3 Then p\speed=4 p\gfx = poison3 EndIf pcounter = 0 EndIf ;steuerung If KeyDown(205) mx=mx+8 EndIf If KeyDown(203) mx=mx-8 EndIf Cls DrawImage landschaft,x,y DrawImage Mammoth,mx,my For c.cookie=Each cookie DrawImage c\gfx,c\x,c\y c\y = c\y + c\speed If ImagesCollide(Mammoth,mx,my,0,c\gfx,c\x,c\y,0) Then Delete c.Cookie points = points+10 PlaySound(ch1) If quest=1 Then schirm_count=schirm_count-1:eat_1=eat_1+1 If quest=2 Then schoko_count=schoko_count-1:eat_2=eat_2+1 If quest=3 Then eaten_count=eaten_count-1:eat_3=eat_3+1 EndIf Next If quest=1 Then If schirm_count=0 Then quest=2 EndIf EndIf If quest=2 Then If schoko_count=0 Then quest=3 EndIf EndIf If quest=3 Then If eaten_count=0 Then Gosub endScore ;quest=4 EndIf EndIf Text 10,90,"LEVEL: "+quest If quest=1 Then Text 760,40,schirm_count+"x Schirmkeks" If quest=2 Then Text 760,40,schoko_count+"x Schokokeks" If quest=3 Then Text 760,40,eaten_count+"x Angebissene" Flip 0 Wend End Mfg, N0X |
||
Projekte: |Tibario| http://www.blitzforum.de/worklogs/325/ | 5% |
- Zuletzt bearbeitet von N0X am Sa, Jan 09, 2010 14:35, insgesamt einmal bearbeitet
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
An welcher Stelle unterscheidest du denn die Kekse voneinander?
Du könntest übrigens vieles etwas kürzer mit select ![]() ![]() |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
N0X |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ach mist, stimmt, ich dachte ich kann das einfach mit der Variale quest lösen das wenn ein neues Level erreicht wurde einfach quest 1 höher gesetzt wird, und so dann unterschieden wird welcher Keks das ist. (Also Level-Kekse.) Wie kann ich das denn anders lösen? Ich habe mal gehört einfach Id's zu vergeben, aber wie? | ||
Projekte: |Tibario| http://www.blitzforum.de/worklogs/325/ | 5% |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wozu Id's? Du kannst die Kekse eindeutig anhand des Bildes identifizieren. | ||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
N0X |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hm, und wie soll das von statten gehen?
Code: [AUSKLAPPEN] For c.cookie=Each cookie
DrawImage c\gfx,c\x,c\y c\y = c\y + c\speed If ImagesCollide(Mammoth,mx,my,0,c\gfx,c\x,c\y,0) Then Delete c.Cookie points = points+10 PlaySound(ch1) If c\gfx = cookie Then schirm_count=schirm_count-1:eat_1=eat_1+1 If c\gfx = cookie2 Then schoko_count=schoko_count-1:eat_2=eat_2+1 If c\gfx = cookie3 Then eaten_count=eaten_count-1:eat_3=eat_3+1 EndIf Next So geht das ja schonmal nicht. |
||
Projekte: |Tibario| http://www.blitzforum.de/worklogs/325/ | 5% |
![]() |
count-doku |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
klar gehts nicht du versuchst auf einen Keks zuzugreifen den du schon gelöscht hast. Mach es so: BlitzBasic: [AUSKLAPPEN] For c.cookie=Each cookie |
||
![]() |
N0X |
![]() Antworten mit Zitat ![]() |
---|---|---|
Danke! ![]() Klappt wunderbar! |
||
Projekte: |Tibario| http://www.blitzforum.de/worklogs/325/ | 5% |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group