Shuttle

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

SpionAtom

Betreff: Shuttle

BeitragSa, Jul 23, 2005 13:41
Antworten mit Zitat
Benutzer-Profile anzeigen
Sehr einfach, sehr verbesserungswürdig und sehr häßlich.
Gesteuert wird mit den Pfeiltasten.
Ach ja: Schießen kann man auch: Mit Space.
Ich setze diesen Code hier ins Forum, weil jemand mich gefragt hat, wie man sowas denn machen könnte. Und da dachte ich, villeicht hilft es ja mehreren.

Code: [AUSKLAPPEN]

;von Thomas Decker - begonnen 1.Oktober 2004
Const xr=1024, yr=768
Graphics xr,yr,16,2
SetBuffer BackBuffer()



   ;Angaben zum Shuttle
   Global richtungswinkel# = 0.0
   Global morphfaktor# = 1.0
   Global posx# = xr/2
   Global posy# = yr/2
   Global geschwfaktor# = 1.00
   Global drehgeschw = 1


   ;Schüsse
   Const maxFire = 20
   Const firerate = 20 ;alle <firerate> Frames ein neuer Schuss
   Global fireratezaehler = 1
   Const fireGeschw# = 5
   Dim fire(5,maxFire) ;0-mittex, 1-mittey, 2-winkel, 3-radius, 4-xpos, 5-ypos



   ;Falls man die Abgase haben will
   Const maxabgaspartikel = 100
   Const abgasvorkommen# = 0.5
   Const abgasverbleib# = 0.95
   Dim abgas(1,maxabgaspartikel)
   
   Repeat
      
      fps = fps + 1
      If frameSZ+1000 < MilliSecs() Then
         frameSZ = MilliSecs()
         fpsAnzeige = fps
         fps = 0
      End If
      




         If KeyDown(200) Then
            geschwfaktor = geschwfaktor + 0.1
            If geschwfaktor > 3 Then geschwfaktor = 3
         End If
         
         If KeyDown(208) Then
            geschwfaktor = geschwfaktor - 0.1
            If geschwfaktor < 0 Then geschwfaktor = 0
         End If

         
         If KeyDown(203) Then
            richtungswinkel = (richtungswinkel+drehgeschw) Mod 360
         End If

         If KeyDown(205) Then
            richtungswinkel = (richtungswinkel-drehgeschw) Mod 360
         End If
         
         If KeyDown(78) Then
            morphfaktor = morphfaktor+0.01
         End If
         
         If KeyDown(74) Then
            morphfaktor = morphfaktor-0.01
            If morphfaktor < 0.1 Then morphfaktor = 0.1
         End If
      
         If KeyDown(57) Then
            If fireRateZaehler = 1 Then
               For i=0 To maxFire
                  If fire(0,i) <= 0 Then Exit
               Next
                  If fire(0,i) <= 0 Then
                     fire(0,i) = posx
                     fire(1,i) = posy
                     fire(2,i) = richtungswinkel
                     fire(3,i) = 40*morphfaktor
                     fireRateZaehler = -fireRate
                  End If
            End If
         End If
         
         If fireRateZaehler<1 Then fireRateZaehler = fireRateZaehler+1
         
            
         
   

      Cls
         Color 0,100,0
         Text 0,0,geschwfaktor
         Text 45,0,richtungswinkel
         Text 90,0,morphfaktor
         Text 10,15,posx
         Text 10,30,posy
         Text 0,yr-15,fpsAnzeige
      
            posx = posx-Sin(richtungswinkel)*geschwfaktor
            posy = posy-Cos(richtungswinkel)*geschwfaktor
            If posx < 1 Then posx = 1
            If posx > xr-1 Then posx = xr-1
            If posy < 1 Then posy = 1
            If posy > yr-1 Then posy = yr-1
            
            ;Schuss berechnen und malen
            Color 255,255,0
            For i=0 To maxFire
               If fire(0,i) > 0 Then
                  xx = fire(0,i)-Sin(fire(2,i))*fire(3,i)
                  yy = fire(1,i)-Cos(fire(2,i))*fire(3,i)
                  xx2 = fire(0,i)-Sin(fire(2,i))*(fire(3,i)+10)
                  yy2 = fire(1,i)-Cos(fire(2,i))*(fire(3,i)+10)
                  Line xx, yy,xx2,yy2
                  fire(3,i) = fire(3,i)+fireGeschw
                  If xx<0 Or yy<0 Or xx>xr Or yy>yr Then fire(0,i) = -1
               End If
            Next
               

            ;Abgase generieren und zeichnen
            If Rnd#(1) <= abgasvorkommen# And geschwfaktor > 0 Then
               For i=0 To maxabgaspartikel
               If abgas(0,i) <= 0 Then Exit
               Next
               abgas(0,i) = posx+5-Rand(10)
               abgas(1,i) = posy+5-Rand(10)
            End If         
            For i=0 To maxabgaspartikel
            Color 255,Rand(155),Rand(155)
            If abgas(0,i)>0 Then Oval abgas(0,i)+1-Rand(2),abgas(1,i)+1-Rand(2),2,2
            If Rnd#(1)>abgasverbleib Then abgas(0,i) = -1
            Next
      
         drawShuttle posx, posy, richtungswinkel, morphfaktor, 255,255,255
         

            

            
      Flip()
      ;Delay 1
      
      
      
   Until KeyDown(1)
   



End










Function drawShuttle(x_posi, y_posi, drehwinkel#, radiusfaktor#,farbeR,farbeG,farbeB)
;         1
;        /  \
;      2      6
;      |   4   |
;      3 /     \   5
;


punktx1 = x_posi-Sin(0+drehwinkel Mod 360)*40*radiusfaktor
punkty1 = y_posi-Cos(0+drehwinkel Mod 360)*40*radiusfaktor

punktx2 = x_posi-Sin(90+drehwinkel Mod 360)*20*radiusfaktor
punkty2 = y_posi-Cos(90+drehwinkel Mod 360)*20*radiusfaktor

punktx3 = x_posi-Sin(145+drehwinkel Mod 360)*30*radiusfaktor
punkty3 = y_posi-Cos(145+drehwinkel Mod 360)*30*radiusfaktor

punktx4 = x_posi-Sin(180+drehwinkel Mod 360)*10*radiusfaktor
punkty4 = y_posi-Cos(180+drehwinkel Mod 360)*10*radiusfaktor

punktx5 = x_posi-Sin(215+drehwinkel Mod 360)*30*radiusfaktor
punkty5 = y_posi-Cos(215+drehwinkel Mod 360)*30*radiusfaktor

punktx6 = x_posi-Sin(270+drehwinkel Mod 360)*20*radiusfaktor
punkty6 = y_posi-Cos(270+drehwinkel Mod 360)*20*radiusfaktor


Color farbeR,farbeG,farbeB

Line punktx1, punkty1, punktx2, punkty2
Line punktx2, punkty2, punktx3, punkty3
Line punktx3, punkty3, punktx4, punkty4
Line punktx4, punkty4, punktx5, punkty5
Line punktx5, punkty5, punktx6, punkty6
Line punktx6, punkty6, punktx1, punkty1

;Zusatzlinien
Line punktx1, punkty1, punktx3, punkty3
Line punktx1, punkty1, punktx4, punkty4
Line punktx1, punkty1, punktx5, punkty5

End Function

orpheus_2003

Betreff: damit jemand mal was schreibt

BeitragDi, Sep 13, 2005 13:56
Antworten mit Zitat
Benutzer-Profile anzeigen
finds net schlecht.

die partikel Engine.. *g* ist net schlecht.
Aber die Steuerung, schiff usw. Ist. Naja.
Für Anfang net schlecht.....

Als Retro Demo.. Ists cool.

Greets M Rolling Eyes
GazerStar - the beginning
http://gazerstar.lexigame.de/
Wizard (Worktitel)
http://wizard.lexigame.de

maximilian

BeitragDi, Sep 13, 2005 17:02
Antworten mit Zitat
Benutzer-Profile anzeigen
Wäre gut wenn tatsächlich ne Mini-"Partikel-Engine" drin wäre. Rolling Eyes
Variety is the spice of life. One day ignore people, next day annoy them.

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group