Author Topic: Shoot Em Up - Video  (Read 35614 times)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Shoot Em Up - Video
« on: 2007-Jun-27 »
Hier (en) ein kleines Video, wie man ein Ballerspiel machen kann.
http://www.glbasic.com/files/shump-tut.wmv

Offline Antidote

  • Mr. Polyvector
  • ***
  • Posts: 164
    • View Profile
    • http://antidotes.wordpress.com
Shoot Em Up - Video
« Reply #1 on: 2007-Jun-27 »
thx Gernot!!
Du bist echt der Schnellste :)

Werde Morgen nach der Arbeit gleich versuchen das Umzusetzen.
PC Core2Duo e4300, 2GBRam, Geforce 8800GT-1gb, XPsp3
GP2x, Wii, XBox360, Wiz, psp, ps3 usw.

Offline Antidote

  • Mr. Polyvector
  • ***
  • Posts: 164
    • View Profile
    • http://antidotes.wordpress.com
Shoot Em Up - Video
« Reply #2 on: 2007-Sep-24 »
Hallo,
vielleicht ist es nach der Schicht schon zu spät, aber wo liegt hier der Fehler??
Code: (glbasic) [Select]
// --------------------------------- //
// Project: Cargame
// Start: Monday, September 24, 2007
// IDE Version: 5.022

TYPE SHOT
x
y
ENDTYPE


LOADBMP "bg.bmp"
LOADSPRITE "car.bmp", 0
LOADSPRITE "schuss.bmp", 1

LOCAL shots[] AS shot


WHILE TRUE
INC playerx, MOUSEAXIS(0)
playerx = MAX(MIN(playerx, 600), 32)


IF MOUSEAXIS(3) AND delay LOCAL shot AS SHOT
shot.x = playerx
shot.y = 300
DIMPUSH shots[], SHOT
delay = GETTIMERALL()+100

ENDIF


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
Es wird folgenes ausgegeben:
"Cargame.gbas"(28) error : wrong argument type : Type shot is not declared

:(
Vielleicht kann mir das jemand erklären?!

thx Antidote


edit:
ich habe das Shutem Up als Vorlage genommen, wie unschwer zu erkennen. ;)
PC Core2Duo e4300, 2GBRam, Geforce 8800GT-1gb, XPsp3
GP2x, Wii, XBox360, Wiz, psp, ps3 usw.

HeikoJ

  • Guest
Shoot Em Up - Video
« Reply #3 on: 2007-Sep-25 »
Hallo Antidote

ich würde sagen das der Fehler hier liegt.

LOCAL shots[] AS shot

Denn SHOT ist von dir in Großbuchstaben definiert worden.

Gruß Heiko

Offline Antidote

  • Mr. Polyvector
  • ***
  • Posts: 164
    • View Profile
    • http://antidotes.wordpress.com
Shoot Em Up - Video
« Reply #4 on: 2007-Sep-25 »
mmhhh,
ja da hast Du recht, allerdings will das prg. trotzdem nicht...
Er zeigt mir den Fehler bei :
Code: (glbasic) [Select]
DIMPUSH shots[], SHOTan :(

Wenn ich die "SHOT" Sache komplett rausnehme, funzt es... also ich kann die "Figur / Car" von links nach rechts bewegen!!
PC Core2Duo e4300, 2GBRam, Geforce 8800GT-1gb, XPsp3
GP2x, Wii, XBox360, Wiz, psp, ps3 usw.

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Shoot Em Up - Video
« Reply #5 on: 2007-Sep-25 »
für DIMPUSH benötigst du ja noch mal neben dem Array eine Hilfsvariable vom Typ SHOT

also:

Code: (glbasic) [Select]
DIM shots[] AS SHOT
DIM shot as SHOT

DIMPUSH shots[], shot
dann sollte es gehen

ähh sehe grad, die hast du ja schon im Coding, also SHOT ist die Typ-Vereinbarung, shot ist die Variable, mit der du arbeitest.

HeikoJ

  • Guest
Shoot Em Up - Video
« Reply #6 on: 2007-Sep-25 »
Hallo Antdote,

du müßtest mal etwas mehr Unterscheidungen in deine Variablennamen bringen.

SHOT (Großgeschriebe) ist dein TYPE
shot  (kleingeschrieben) ist deine Variable.

also mußt Du schreiben : DIMPUSH shots[], shot

Ich definiere meine TYPE immer mit einem vorgrstellten T --> TShot.
dann weis ich auch später noch das dies die TYPE-Definition war.


Gruß Heiko

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10859
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Shoot Em Up - Video
« Reply #7 on: 2007-Sep-25 »
HeikoJ - super Idee - werde ich für weitere Demos beherzigen.

Offline BumbleBee

  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 891
    • View Profile
Shoot Em Up - Video
« Reply #8 on: 2007-Sep-26 »
Ja, das kenn ich auch. Man stellt der Variable den Buchstaben für den Datentyp voran.b=Boolean,i=Integer... Also bShot zum Bleistift. Dann kann man's im Programm besser lesen. Mach ich auch (manchmal).:D Und Konstanten schreibt man meistens groß.  

Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Shoot Em Up - Video
« Reply #9 on: 2007-Sep-26 »
Ne Bee.

Locale klein schreiben Globale groß!
^^
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline BumbleBee

  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 891
    • View Profile
Shoot Em Up - Video
« Reply #10 on: 2007-Sep-26 »
Können so viele Bücher irren?:D Das ist ja grad der Witz Konstanten KOMPLETT GROß zu schreiben. Daran erkennt man dann,  das es sich um eine Konstante und nicht um eine Variable handelt. Viele machen's angeblich so.
Beispiel:

CONST PI  (Wer kennt sie nicht) ;)
CONST MEHRWEHRTSTEUER (Naja wie lange die halt konstant bleibt)
CONST ALKOHOLPEGEL    (Ist bei einigen die ich kenn,echt immer konstant) :D

Na denn schönen Tag noch.:)

Cheers
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Shoot Em Up - Video
« Reply #11 on: 2007-Sep-26 »
OK der ALKOHOLPEGEL hat mich überzeugt!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Shoot Em Up - Video
« Reply #12 on: 2007-Sep-26 »
*rofl*

Bee zustimm. Konstanten groß, aber ist ja nur eine Konvention, ansonsten jedem, wie es ihm behagt.

Offline Antidote

  • Mr. Polyvector
  • ***
  • Posts: 164
    • View Profile
    • http://antidotes.wordpress.com
Shoot Em Up - Video
« Reply #13 on: 2007-Sep-26 »
Hi, hatte Nachtschicht, daher kann ich erst jetzt antworten.
Vielen Dank für die Hilfe und die Tips/Hinweise. Da werde ich mich gleich mal dran machen!
Greetz
PC Core2Duo e4300, 2GBRam, Geforce 8800GT-1gb, XPsp3
GP2x, Wii, XBox360, Wiz, psp, ps3 usw.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Shoot Em Up - Video
« Reply #14 on: 2007-Sep-26 »
Was, an den CONST ALKOHOLPEGEL ? :D
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard