// --------------------------------- //
// Project: qaswd
// Start: Tuesday, April 14, 2009
// IDE Version: 6.222
// DEMO-VERSION:
// Missing features:
// No time limit during gameplay
// No watermark in executables
TYPE SHOT
x
y
ENDTYPE
TYPE FOE
x
y
speed = 3
amour = 4
ENDTYPE
TYPE BOOM
x
y
time
ENDTYPE
LOADSPRITE "ship.bmp", 0
LOADSPRITE "shot.png", 1
LOADSPRITE "bug.png", 2
LOADSPRITE "boom.png", 3
LOCAL shots [] AS SHOT
LOCAL bugs[] AS FOE
LOCAL poof[] AS BOOM
WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx = MAX(MIN(playerx, 800), 32)
IF MOUSEAXIS(3) AND delay<GETTIMERALL()
LOCAL shot AS SHOT
shot.x = playerx
shot.y = 500
DIMPUSH shots[], shot
dealy = GETTIMERALL()+100
ENDIF
time = GETTIMERALL()
IF time>nextbug
nextbug = time + 500
LOCAL b AS FOE
DIMPUSH bugs[], b
ENDIF
FOREACH bug IN bugs[]
INC bug. x, bug.speed
IF bug.x<0 OR bug.x>750
bug.speed = -bug.speed
INC bug.y, 32
ENDIF
didhit=FALSE
FOREACH pop IN shots[]
IF BOXCOLL(pop.x, pop.y, 8,8, bug.x, bug.y, 32,32)
didhit=TRUE
DELETE pop
ENDIF
NEXT
IF didhit
LOCAL p AS BOOM
p.x = bug.x
p.y = bug.y
p.time = time
DIMPUSH poof[], p
DELETE bug
ENDIF
DRAWSPRITE 2, bug.x, bug.y
NEXT
FOREACH p IN poof[]
pos = (time = p-time)/100 // 0 ... 1
IF pos > 1 THEN DELETE p
ROTOZOOMSPRITE 3, p.x, p.y, pos*1000, 1 + pos*3
FOREACH pop IN shots[]
DEC pop.y, 5
IF pop.y<0 THEN DELETE pop
DRAWSPRITE 1, pop.x, pop.y
NEXT
DRAWSPRITE 0, playerx, 500
SHOWSCREEN
WEND
ICh finde den nicht es l?st dich nciht starten.
Wenn falsches topic bitte verschieben
These are what I could find, make sure you activate "debug mode" before you start the game, you get more error messages that way.
line 61:
NEXT // Missing a next here I think
line 87:
pos = (time = p-time)/100 // 0 ... 1 // Don't think you can use = more than once on a line?
line 90:
NEXT // Missing a next here I think
Was meinst du mit "Es l?sst sich nicht starten"?
der Kompiliervorgang? ..was kommt denn f?r eine Meldung?
Wie Moru schon sagte, die letzen beiden FOREACH Schleifen haben kein "NEXT".
Achtung:
pos = (time = p-time)/100 // 0 ... 1
(time = p-time) -> p=0 -> TRUE, p<>0 ->FALSE
pos = (TRUE oder FALSE) / 100 -> 0 ODER 1
Was Du willst:
time = p-time
pos = time /100.0 // .0, damit sicher eine Floating point division gemacht wird, falls "time" eine nat?rliche Zahl ist (LOCAL time%)
// --------------------------------- //
// Project: qaswd
// Start: Tuesday, April 14, 2009
// IDE Version: 6.222
// DEMO-VERSION:
// Missing features:
// No time limit during gameplay
// No watermark in executables
TYPE SHOT
x
y
ENDTYPE
TYPE FOE
x
y
speed = 3
amour = 4
ENDTYPE
TYPE BOOM
x
y
time
ENDTYPE
LOADSPRITE "ship.bmp", 0
LOADSPRITE "shot.png", 1
LOADSPRITE "bug.png", 2
LOADSPRITE "boom.png", 3
LOCAL shots [] AS SHOT
LOCAL bugs[] AS FOE
LOCAL poof[] AS BOOM
WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx = MAX(MIN(playerx, 800), 32)
IF MOUSEAXIS(3) AND delay<GETTIMERALL()
LOCAL shot AS SHOT
shot.x = playerx
shot.y = 500
DIMPUSH shots[], shot
dealy = GETTIMERALL()+100
ENDIF
time = GETTIMERALL()
IF time>nextbug
nextbug = time + 500
LOCAL b AS FOE
DIMPUSH bugs[], b
ENDIF
FOREACH bug IN bugs[]
INC bug. x, bug.speed
IF bug.x<0 OR bug.x>750
bug.speed = -bug.speed
INC bug.y, 32
ENDIF
NEXT
didhit=FALSE
FOREACH pop IN shots[]
IF BOXCOLL(pop.x, pop.y, 8,8, bug.x, bug.y, 32,32)
didhit=TRUE
DELETE pop
ENDIF
NEXT
IF didhit
LOCAL p AS BOOM
p.x = bug.x
p.y = bug.y
p.time = time
DIMPUSH poof[], p
[font=Verdana][color=red][b]DELETE bug[/b][/color][/font]
ENDIF
DRAWSPRITE 2, bug.x, bug.y
NEXT
FOREACH p IN poof[]
pos = (time = p-time)/100 // 0 ... 1
IF pos > 1 THEN DELETE p
ROTOZOOMSPRITE 3, p.x, p.y, pos*1000, 1 + pos*3
FOREACH pop IN shots[]
DEC pop.y, 5
IF pop.y<0 THEN DELETE pop
DRAWSPRITE 1, pop.x, pop.y
NEXT
DRAWSPRITE 0, playerx, 500
SHOWSCREEN
WEND
so das next habe ich hin gemacht jetzt zeigt er mir den n?hster fehler an
er ist makiert
Lies nochmal was Moru und Gernot geschrieben haben, und dann kuck nochmal genau auf deinen Code. Und der Compiler sagt dir ja auch noch genau was ihm nicht passt. :P
Cheers
// --------------------------------- //
// Project: qaswd
// Start: Tuesday, April 14, 2009
// IDE Version: 6.222
// DEMO-VERSION:
// Missing features:
// No time limit during gameplay
// No watermark in executables
TYPE SHOT
x
y
ENDTYPE
TYPE FOE
x
y
speed = 3
amour = 4
ENDTYPE
TYPE BOOM
x
y
time
ENDTYPE
LOADSPRITE "ship.png", 0
LOADSPRITE "shot.png", 1
LOADSPRITE "bug.png", 2
LOADSPRITE "boom.png", 3
LOCAL shots [] AS SHOT
LOCAL bugs[] AS FOE
LOCAL poof[] AS BOOM
WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx = MAX(MIN(playerx, 800), 32)
IF MOUSEAXIS(3) AND delay<GETTIMERALL()
LOCAL shot AS SHOT
shot.x = playerx
shot.y = 500
DIMPUSH shots[], shot
dealy = GETTIMERALL()+100
ENDIF
time = GETTIMERALL()
IF time>nextbug
nextbug = time + 500
LOCAL b AS FOE
DIMPUSH bugs[], b
ENDIF
FOREACH bug IN bugs[]
INC bug. x, bug.speed
IF bug.x<0 OR bug.x>750
bug.speed = -bug.speed
INC bug.y, 32
ENDIF
NEXT
didhit=FALSE
FOREACH pop IN shots[]
IF BOXCOLL(pop.x, pop.y, 8,8, bug.x, bug.y, 32,32)
didhit=TRUE
DELETE pop
ENDIF
NEXT
IF didhit
LOCAL p AS BOOM
p.x = bug.x
p.y = bug.y
time = p-time
DIMPUSH poof[], p
DELETE BUG
ENDIF
DRAWSPRITE 2, bug.x, bug.y
NEXT
FOREACH p IN poof[]
pos = time /100.0 // .0,
IF pos > 1 THEN DELETE p
ROTOZOOMSPRITE 3, p.x, p.y, pos*1000, 1 + pos*3
FOREACH pop IN shots[]
DEC pop.y, 5
IF pop.y<0 THEN DELETE pop
DRAWSPRITE 1, pop.x, pop.y
NEXT
DRAWSPRITE 0, playerx, 500
SHOWSCREEN
WEND
So habe es verbesser er zeigt mir bei DELETE bug an
"qaswd.gbas"(81) error : wrong argument type : Must be:
Mach aus :
DELETE BUG
ein
DELETE bug
Gro?- und Kleinschreibung bitte in GLBasic beachten!
habe ich gemacht zeigt da immer noch ein fehler an
"qaswd.gbas"(81) error : wrong argument type : Must be:
Du hast massig For - Next falsch gesetzt!
Fehler mit "p-time" muss sein "p.time".
Fang doch nochmal von vorne an, und bring da ein wenig Struktur rein.
Wichtig ist, sauberes Einr?cken.(teilweise vorhanden)
zum Grundverst?ndnis
FOREACH shot IN TShots[]
// Code was mit dem schuss gemacht wird
// z.b bewegen
DEC shot.y, 2
DRAWSPRITE shot.pic, shot.x, shot.y
// usw...
FOREACH enemy IN TEnemy[]
// hier kannst du shot und enemy verwenden!
IF SPRCOLL(enemy.pic, enemy.x, enemy.y, shot.pic, shot.x, shot.y)
DELETE enemy
DELETE shot
INC Score, 100
ENDIF
NEXT
// Hier ist enemy nicht mehr aufrufbar!
NEXT
ok werde noch mal von vorne anfangen
// --------------------------------- //
// Project: Blaster
// Start: Thursday, April 05, 2007
// IDE Version: 4.145
TYPE SHOT
x
y
ENDTYPE
TYPE FOE
x
y
speed=3
amour=4
ENDTYPE
TYPE BOOM
x
y
time
ENDTYPE
LOCAL newshot AS SHOT
LOCAL newbug AS FOE
LOCAL shots[] AS SHOT
LOCAL bugs[] AS FOE
LOCAL poof[] AS BOOM
LOADSPRITE "ship.PNG", 0
LOADSPRITE "shot.PNG", 1
LOADSPRITE "bug.PNG", 2
LOADSPRITE "boom.PNG", 3
playerx = 320
WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx=MAX(MIN(playerx,600),40)
IF MOUSEAXIS(3) AND delay
newshot.x = playerx
newshot.y = 400
DIMPUSH shots[], newshot
delay = GETTIMERALL() + 100
ENDIF
time = GETTIMERALL()
IF time>nextbug
nextbug = time + 500
DIMPUSH bugs[], newbug
ENDIF
FOREACH bug IN bugs[]
INC bug.x, bug.speed
IF bug.x<0 OR bug.x>620
INC bug.y, 32
bug.speed = -bug.speed
ENDIF
didhit=FALSE
FOREACH pop IN shots[]
IF BOXCOLL(pop.x, pop.y, 8,8, bug.x, bug.y, 32,32)
didhit=TRUE
DELETE pop
ENDIF
NEXT
IF didhit
LOCAL p AS BOOM
p.x = bug.x
p.y = bug.y
p.time = time
DIMPUSH poof[], p
DELETE bug
ENDIF
DRAWSPRITE 2, bug.x, bug.y
NEXT
FOREACH p IN poof[]
LOCAL pos = (time - p.time) / 1000
IF pos > 1 THEN DELETE p
ALPHAMODE 1-pos
ROTOZOOMSPRITE 3, p.x, p.y, pos*1000, 1+pos*3
NEXT
ALPHAMODE 0
FOREACH pop IN shots[]
DEC pop.y, 5
IF pop.y<0 THEN DELETE pop
DRAWSPRITE 1, pop.x, pop.y
NEXT
DRAWSPRITE 0, playerx, 400
SHOWSCREEN
WEND
hier ist es noch mal neu jetzt funzt auch alles er l?dt aber die bilder nicht er startet das pogramm schlie?t es aber sofort.
You declare p as different types, compiler don't like that. Always use a different name for each type you declare to keep out of trouble :-)
kann mir einer den code nicht richtig machen ich klicke auf pogramm starten dann schreibt er unten
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2009.098 - 2D, WIN32
Wordcount:0 commands
compiling:
linking:
erfolgreich
_______________________________________
*** Fertig ***
Dauer: 1.5 sek. Zeit: 11:28
Erstellen: 1 erfolgreich.
dann startet er kurz das pogramm man sieht den schrift zug loading und dann schlie? sich alles wieder
time = GETTIMERALL()
IF MOUSEAXIS(3) AND delay<time
Das musste man vertauschen, damit man schie?en kann.
Seltsamerweise hatte ich kl. Probleme als ich von Konsole auf Windows umgeschalten habe.
Bitte schalte den Debug Modus einmal aus, und wieder neu ein.
Na du sollst es ja lernen, ich hab dir jetzt gezeigt wie es richtig geht, musst du ja nurnoch richtig umsetzen. :)
Du solltest evtl mal kleiner anfangen, weil Types bzw. die Standartsachen wie For-Next scheind mir so, als h?ttest du das noch nicht ganz verstanden?!
Quote from: Kitty Hello on 2009-Apr-15
time = GETTIMERALL()
IF MOUSEAXIS(3) AND delay<time
Das musste man vertauschen, damit man schießen kann.
Seltsamerweise hatte ich kl. Probleme als ich von Konsole auf Windows umgeschalten habe.
Bitte schalte den Debug Modus einmal aus, und wieder neu ein.
// --------------------------------- //
// Project: Blaster
// Start: Thursday, April 05, 2007
// IDE Version: 4.145
TYPE SHOT
x
y
ENDTYPE
TYPE FOE
x
y
speed=3
amour=4
ENDTYPE
TYPE BOOM
x
y
time
ENDTYPE
LOCAL newshot AS SHOT
LOCAL newbug AS FOE
LOCAL shots[] AS SHOT
LOCAL bugs[] AS FOE
LOCAL poof[] AS BOOM
LOADSPRITE "ship.PNG", 0
LOADSPRITE "shot.PNG", 1
LOADSPRITE "bug.PNG", 2
LOADSPRITE "boom.PNG", 3
playerx = 320
WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx=MAX(MIN(playerx,600),40)
time = GETTIMERALL()
newshot.x = playerx
newshot.y = 400
DIMPUSH shots[], newshot
delay = GETTIMERALL() + 100
ENDIF
IF MOUSEAXIS(3) AND delay
IF time>nextbug
nextbug = time + 500
DIMPUSH bugs[], newbug
ENDIF
FOREACH bug IN bugs[]
INC bug.x, bug.speed
IF bug.x<0 OR bug.x>620
INC bug.y, 32
bug.speed = -bug.speed
ENDIF
didhit=FALSE
FOREACH pop IN shots[]
IF BOXCOLL(pop.x, pop.y, 8,8, bug.x, bug.y, 32,32)
didhit=TRUE
DELETE pop
ENDIF
NEXT
IF didhit
LOCAL p AS BOOM
p.x = bug.x
p.y = bug.y
p.time = time
DIMPUSH poof[], p
DELETE bug
ENDIF
DRAWSPRITE 2, bug.x, bug.y
NEXT
FOREACH p IN poof[]
LOCAL pos = (time - p.time) / 1000
IF pos > 1 THEN DELETE p
ALPHAMODE 1-pos
ROTOZOOMSPRITE 3, p.x, p.y, pos*1000, 1+pos*3
NEXT
ALPHAMODE 0
FOREACH pop IN shots[]
DEC pop.y, 5
IF pop.y<0 THEN DELETE pop
DRAWSPRITE 1, pop.x, pop.y
NEXT
DRAWSPRITE 0, playerx, 400
SHOWSCREEN
WEND
so habe ich gemacht aber es startet immer noch nicht.
Quote from: Schranz0r on 2009-Apr-15
Na du sollst es ja lernen, ich hab dir jetzt gezeigt wie es richtig geht, musst du ja nurnoch richtig umsetzen. :)
Du solltest evtl mal kleiner anfangen, weil Types bzw. die Standartsachen wie For-Next scheind mir so, als hättest du das noch nicht ganz verstanden?!
ich habe auch kein vernüftiges tutorial gefunden ich habe mir eins genommen und einfach man befolgt
Was macht das ENDIF da oben ohne IF. Oder seh ich schon schlecht? ;)
Hier nach
delay = GETTIMERALL() + 100
ENDIF
Cheers
Ich habe das Gef?hl, dass Du ein bischen weiter unten einsteigen solltest.
Schau Dir mal die Tutorials im Handbuch an (F1 im Editor).
da ist ein tutorial danke werde ich mal machen^^
@ Gernot:
Glaube wir sollten dochmal ein gr??eres Tutorial machen :D
Das Horiz-Shooter Tut ist ja auch ganz gut.
Ich wei?, das Buch/Script f?r einen Unterricht w?re mal cool.
hatte ja mal Wiki angefangen, aber alleine hatte ich da auch keine Lust das zu machen :(
so hi ich habe jetzt mein ersten spiel fertig aus dem tutorial nun habe ich noch eine frage kann man irgent wie ein intro ein bauen das ein bild zeigt und dann vieleicht noch ein und dann erst das spiel startet
BLENDSCREEN "MainBild.png"
KEYWAIT
BLACKSCREEN
Du solltest wirklich versuchen zu verstehen, was Du programmiert hat. Lies die Beschreibung der Befehle die Du verwendet hast, und frag' wenn Du Dir nicht sicher bist.
www.svenjuette.kilu.de k?nnt ihr es euch runterladen