Planeten-Umlaufbahn [2D]

Übersicht BlitzBasic Allgemein

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen

Sephka

BeitragFr, Sep 17, 2010 18:14
Antworten mit Zitat
Benutzer-Profile anzeigen
1.mmmh kay
2. Dein 2D Galaxie Pogramm
3.mmmh kay
lg Sephka
 

Krischan

BeitragFr, Sep 17, 2010 18:16
Antworten mit Zitat
Benutzer-Profile anzeigen
2) Ja natürlich.

Hab aus Langeweile noch mal schnell mein 3D Interplanetary Travel in ein 2D Sonnensystem umgebaut, mit den Maustasten kann man zoomen und mit den Pfeiltasten sich bewegen (die Bewegung mit der "Kamera" ist aber nur ganz simpel implementiert).

Also diesmal mit Monden die die Planeten umkreisen. Ist aber auch dementsprechend komplexer:

Code: [AUSKLAPPEN]
AppTitle "Advanced 2D Solar System"

Graphics3D 800,600,32,2

SeedRnd MilliSecs()

Const MOONS=29          ; number of moons to read
Const PLANETS=9         ; number of planets to read
Const RANDOMIZE%=True   ; random positions on/off
Const DAYINC#=1.0/60     ; time increment per cycle
Const YEAR#=365.256     ; earth year in days
Global SCALE#=2500        ; zoom scale
Global camx%,camy%

Global WIDTH%=GraphicsWidth()
Global HEIGHT%=GraphicsHeight()
Global TIMER%=CreateTimer(60)

Global S.System=New System

Global DAYS#,MAXDIST#,CALCTIME#,ZOOM#

Type Moon
   
    Field id%
    Field parent%
    Field name$
    Field radius#
    Field period#
    Field size#
    Field r%,g%,b%
    Field SPEED#
    Field random%
   
End Type

Type Planet
   
    Field id%
    Field parent%
    Field name$
    Field radius#
    Field period#
    Field size#
    Field r%,g%,b%
    Field MOONS%
    Field moon.Moon[MOONS]
    Field SPEED#
    Field random%
    Field x%,y%
   
End Type

Type System
   
    Field planet.Planet[PLANETS]
   
End Type

; init planet and moon objects and update once
Initialize()
UpdateObjects()

MoveMouse WIDTH/2,HEIGHT/2


;===========================================================================
; main loop
;===========================================================================

While Not KeyHit(1)
   
    Cls
   
    SCALE=SCALE+((MouseDown(1)-MouseDown(2))*Sqr(SCALE))
    camx=camx+((KeyDown(203)-KeyDown(205))*Sqr(SCALE/10.0))
    camy=camy+((KeyDown(200)-KeyDown(208))*Sqr(SCALE/10.0))
   
    DAYS=DAYS+DAYINC
   
    Color 255,255,0
    Oval WIDTH/2-3+camx,HEIGHT/2-3+camy,6,6,1
   
    ; update object positions
    UpdateObjects()
   
    WaitTimer TIMER
   
    Text 0, 0,"Scale  : "+SCALE
    Text 0,15,"Cam X/Y: "+camx+","+camy
   
    Flip 0
   
Wend

End


;===========================================================================
; read planet/moon data and create objects, fill types
;===========================================================================

Function Initialize()
   
    Local p%,m%
    Local parent%,name$,radius#,period#,size#,r%,g%,b%
    Local speed#,entity%,random%,orbit%
   
   ; read planet data
    Restore PLANETdata
   
    For p=1 To PLANETS
       
        Read parent,name,radius,period,size,r,g,b
       
        ; calc speed and initial position
        speed=YEAR/Float(period)
        If RANDOMIZE Then random=Rnd(0,2^16)
       
        ; add planet
        S\planet[p]=PLANETcreate(p,parent%,name$,radius#,period#,size#,r%,g%,b%,speed,entity,random)
       
    Next
   
    ; read moon data
    Restore MOONDATA
   
    For m=1 To MOONS
       
        Read parent,name,radius,period,size,r,g,b
       
        ; calc speed and initial position
        speed=YEAR/Float(period)
        If RANDOMIZE Then random=Rnd(0,2^16)
       
        ; increase planet's moon counter
        S\planet[parent]\MOONS=S\planet[parent]\MOONS+1
       
        ; add moon
        S\planet[parent]\moon[S\planet[parent]\MOONS]=MOONcreate(S\planet[parent]\MOONS,parent%,name$,radius#,period#,size#,r%,g%,b%,speed,entity,random,orbit)
       
    Next
   
End Function


;===========================================================================
; update object positions
;===========================================================================

Function UpdateObjects()
   
    Local p.Planet,m.Moon,i%
   
    For p.Planet = Each Planet
       
        UpdatePlanet(p\id)
       
        For i=1 To p\MOONS
       
            m.Moon = MOONdata(p\id,i)
       
            If m<>Null Then UpdateMoon(p\id,m\id,p\x,p\y)
           
        Next
       
    Next
   
End Function


;===========================================================================
; create a planet object
;===========================================================================

Function PLANETcreate.Planet(id%,parent%,name$,radius#,period#,size#,r%,g%,b%,speed#,entity%,random%)
   
    Local p.Planet = New Planet
   
    p\id=id
    p\parent=parent
    p\name=name
    p\radius=radius
    p\period=period
    p\size=size
    p\r=r
    p\g=g
    p\b=b
    p\SPEED=-speed
    p\random=random
   
    Return p
   
End Function


;===========================================================================
; create a moon object
;===========================================================================

Function MOONcreate.Moon(id%,parent%,name$,radius#,period#,size#,r%,g%,b%,speed#,entity%,random%,orbit%)
   
    Local m.Moon = New Moon
   
    m\id=id
    m\parent=parent
    m\name=name
    m\radius=radius
    m\period=period
    m\size=size
    m\r=r
    m\g=g
    m\b=b
    m\SPEED=-speed
    m\random=random
   
    Return m
   
End Function


;===========================================================================
; return a moon object handle
;===========================================================================

Function MOONdata.Moon(planet,moon)
   
    Return S\planet[planet]\moon[moon]
   
End Function


;===========================================================================
; return a planet object handle
;===========================================================================

Function PLANETdata.Planet(planet)
   
    Return S\planet[planet]
   
End Function


;===========================================================================
; update a single planet object position according to time
;===========================================================================

Function UpdatePlanet(id%)
   
    Local radiusx#,radiusy#,radius#
    Local xcos#=Cos(360)
    Local xsin#=Sin(360)
    Local tmpx#,tmpy#
    Local x%,y%
   
    Local p.Planet= PLANETdata(id)
   
    radiusx=p\radius
    radiusy=p\radius
   
    tmpx#=(Cos((DAYS*(360.0/YEAR)*p\SPEED)+p\random)*radiusx#)
    tmpy#=(Sin((DAYS*(360.0/YEAR)*p\SPEED)+p\random)*radiusy#)
   
    ; Orbit
    radius=Normalize(p\radius,0,SCALE,0,WIDTH*2)
    Color p\r/4,p\g/4,p\b/4
    Oval Int(400-(radius/2))+camx,Int(300-(radius/2))+camy,radius,radius,0
   
    ; Planet
    x=Normalize(tmpx,-SCALE,SCALE,-WIDTH,WIDTH)
    y=Normalize(tmpy,-SCALE,SCALE,-WIDTH,WIDTH)
    Color p\r,p\g,p\b
    Oval Int((WIDTH/2)+x-1.5)+camx,Int((HEIGHT/2)+y-1.5)+camy,3,3,1
   
    p\x=x
    p\y=y
   
    Text Int((WIDTH/2)+x-1.5)+camx,Int((HEIGHT/2)+y-1.5)+camy-12,p\name,1,1
   
End Function


;===========================================================================
; normalize a value
;===========================================================================

Function Normalize#(value#=128.0,value_min#=0.0,value_max#=255.0,norm_min#=0.0,norm_max#=1.0)
   
    Return ((value#-value_min#)/(value_max#-value_min#))*(norm_max#-norm_min#)+norm_min#
   
End Function


;===========================================================================
; update a single moon object position according to time
;===========================================================================

Function UpdateMoon(planet%,id%,addx%,addy%)
   
    Local radiusx#,radiusy#,radius#
    Local xcos#=Cos(360)
    Local xsin#=Sin(360)
    Local tmpx#,tmpy#,x%,y%
   
    Local p.Planet = PLANETdata(planet)
    Local m.Moon= MOONdata(planet,id)
   
    radiusx=m\radius
    radiusy=m\radius
   
    tmpx#=(Cos((DAYS*(360.0/YEAR)*m\SPEED)+m\random)*radiusx#)
    tmpy#=(Sin((DAYS*(360.0/YEAR)*m\SPEED)+m\random)*radiusy#)
   
    ; Orbit
    radius=Normalize(m\radius,0,SCALE,0,WIDTH*2)*10
    Color 64,64,64
    Oval Int(400-(radius/2))+addx+camx,Int(300-(radius/2))+addy+camy,radius,radius,0
   
    ; Moon
    x=Normalize(tmpx,-SCALE,SCALE,-WIDTH,WIDTH)*10
    y=Normalize(tmpy,-SCALE,SCALE,-WIDTH,WIDTH)*10
    Color 255,255,255
    Oval Int((WIDTH/2)+x-0.5)+addx+camx,Int((HEIGHT/2)+y-0.5)+addy+camy,1,1,1
   
    Text Int((WIDTH/2)+x-1.5)+addx+camx,Int((HEIGHT/2)+y-1.5)+addy+camy-12,m\name,1,1
   
End Function


.PLANETdata

;==========================================================================
;    Parent   Name           Radius      Period      Size     R     G     B
;==========================================================================
Data 0      , "Mercury"  ,   57.909 ,    87.989 ,   4.878 , 255 , 128 ,   0
Data 0      , "Venus"    ,  108.160 ,   224.701 ,   5.000 , 255 , 255 ,   0
Data 0      , "Earth"    ,  149.600 ,   365.256 ,  12.756 ,   0 ,   0 , 255
Data 0      , "Mars"     ,  227.990 ,   686.980 ,   6.794 , 255 ,   0 ,   0
Data 0      , "Jupiter"  ,  778.360 ,  4331.936 , 142.984 , 255 , 192 ,   0
Data 0      , "Saturn"   , 1433.400 , 10759.346 , 120.536 , 255 , 224 ,   0
Data 0      , "Uranus"   , 2872.400 , 30685.522 ,  51.118 ,   0 , 128 , 255
Data 0      , "Neptune"  , 4495.000 , 60190.536 ,  49.528 ,   0 , 255 , 255
Data 0      , "Pluto"    , 5906.400 , 90466.606 ,   2.390 , 255 , 255 , 255


;==========================================================================
;    Parent   Name           Radius      Period      Size     R     G     B
;==========================================================================

.MOONDATA
Data 3     , "Moon"      ,    1.000 ,     1.000 ,   3.476 , 255 , 255 , 255
Data 4     , "Phobos"    ,    1.000 ,     1.000 ,   0.027 , 255 , 255 , 255
Data 4     , "Deimos"    ,    2.000 ,     2.000 ,   0.015 , 255 , 255 , 255
Data 5     , "Amalthea"  ,    1.000 ,     1.000 ,   0.167 , 255 , 255 , 255
Data 5     , "Io"        ,    2.000 ,     2.000 ,   3.643 , 255 , 255 , 255
Data 5     , "Europa"    ,    3.000 ,     4.000 ,   3.122 , 255 , 255 , 255
Data 5     , "Ganymede"  ,    4.000 ,     8.000 ,   5.262 , 255 , 255 , 255
Data 5     , "Callisto"  ,    5.000 ,    16.000 ,   4.821 , 255 , 255 , 255
Data 5     , "Leda"      ,    6.000 ,    32.000 ,   0.020 , 255 , 255 , 255
Data 5     , "Himalia"   ,    7.000 ,    64.000 ,   0.170 , 255 , 255 , 255
Data 5     , "Elara"     ,    8.000 ,   128.000 ,   0.086 , 255 , 255 , 255
Data 5     , "Pasiphae"  ,    9.000 ,   256.000 ,   0.056 , 255 , 255 , 255
Data 6     , "Mimas"     ,    1.000 ,     1.000 ,   0.397 , 255 , 255 , 255
Data 6     , "Enceladus" ,    2.000 ,     2.000 ,   0.504 , 255 , 255 , 255
Data 6     , "Tethys"    ,    3.000 ,     4.000 ,   1.060 , 255 , 255 , 255
Data 6     , "Dione"     ,    4.000 ,     8.000 ,   1.127 , 255 , 255 , 255
Data 6     , "Rhea"      ,    5.000 ,    16.000 ,   1.528 , 255 , 255 , 255
Data 6     , "Titan"     ,    6.000 ,    32.000 ,   5.150 , 255 , 255 , 255
Data 6     , "Hyperion"  ,    7.000 ,    64.000 ,   0.266 , 255 , 255 , 255
Data 6     , "Iapetus"   ,    8.000 ,   128.000 ,   1.436 , 255 , 255 , 255
Data 6     , "Phoebe"    ,    9.000 ,   256.000 ,   0.220 , 255 , 255 , 255
Data 7     , "Miranda"   ,    1.000 ,      1.00 ,   0.472 , 255 , 255 , 255
Data 7     , "Ariel"     ,    2.000 ,      2.00 ,   1.158 , 255 , 255 , 255
Data 7     , "Umbriel"   ,    3.000 ,      4.00 ,   1.169 , 255 , 255 , 255
Data 7     , "Titania"   ,    4.000 ,      8.00 ,   1.578 , 255 , 255 , 255
Data 7     , "Oberon"    ,    5.000 ,     16.00 ,   1.523 , 255 , 255 , 255
Data 8     , "Triton"    ,    1.000 ,      1.00 ,   2.707 , 255 , 255 , 255
Data 8     , "Nereid"    ,    2.000 ,      2.00 ,   0.340 , 255 , 255 , 255
Data 9     , "Charon"    ,    1.000 ,      1.00 ,   1.212 , 255 , 255 , 255

Sephka

BeitragFr, Sep 17, 2010 18:20
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich möchte machen das es verschidene leuchtstärken gibt und davon abhänig machen ab welcher entfernung leben möglich ist,aber wie unter "Habitable Zone" ist die Formel nicht sehr verständlich.
Und (du scheinst dich mit diesem Zeug auszukennen,)können sich sterne bewegen also Planeten sein oder gar einen Planeten umkreisen?
mfg Sephka
EDIT: Wie berechne ich wie lang ein planet brauch zum umkreisen seines sterns?

BladeRunner

Moderator

BeitragFr, Sep 17, 2010 19:40
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich glaube Du zäumst das Pferd vom falschen Ende auf. Für ein Spiel muss die Berechnung doch nicht physikalisch korrekt sein, sie muss dem Spiel dienen und dem Spieler Spass machen. Also pfeiff doch auf den Realismus und mach es so dass es Laune macht und gut aussieht.
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

Sephka

BeitragFr, Sep 17, 2010 19:48
Antworten mit Zitat
Benutzer-Profile anzeigen
Mhhmm,hast eig. Recht so hab ich das noch gar nicht gesehn,ich denk mir die physik selber Wink
Danke
Mfg Sephka

Sephka

BeitragSa, Sep 18, 2010 10:30
Antworten mit Zitat
Benutzer-Profile anzeigen
ich habs jetzt so,was sagt ihr dazu?
Code: [AUSKLAPPEN]
Graphics 800,600,16,2

AppTitle "PLANETON"

SetBuffer BackBuffer()

;Zufall
SeedRnd(MilliSecs())
;Parameter festlegen
Global mx=GraphicsWidth()/2
Global my=GraphicsHeight()/2
Global zoom#=100
Global zeit#=0.1
Global mode = 1;
Global anz = 5,habit
;Types
Type Tplanet
Field name$
Field Radius#
Field Aphel#
Field Perihel#
Field sidper#
Field groesse#
Field rot%,gruen%,blau%
Field ID%
End Type

Type Tstar
Field name$
Field Radius#
Field Aphel#
Field Perihel#
Field sidper#
Field groesse#
Field rot%,gruen%,blau%
Field mag#;bolormetrische korrektur
Field habital#
Field ID%
End Type
;Einen Stern erstellen
star.tstar = New tstar
star\name$ = "Helios"
star\Radius = 0
star\Aphel = 0
star\perihel = 0
star\sidper = 1
star\groesse = 2000
star\rot = 220
star\gruen = 125
star\blau = 0
star\mag = Rnd(0.11,4)
;star\mag = 0.11
star\habital = Float(Sqr(star\mag/0.11))
;Planeten erstellen
Select Mode
Case 1;min. 1 menschnefreundlicher Planet
For z=1 To anz
planet.tplanet = New tplanet
planet\name$ = GenerateName(3,8)
planet\Radius =  (4+3*2^(z-1))*10
planet\Aphel = Rnd(0.9,star\habital)+olda
planet\perihel = Rnd(0.9,star\habital)+oldp
planet\sidper = z*100
planet\groesse = Rnd(2,1200)
planet\rot = Rnd(0,255)
planet\gruen = Rnd(0,255)
planet\blau = Rnd(0,255)
olda = planet\aphel
oldp = planet\perihel
Next
Case 2
For z=1 To anz
planet.tplanet = New tplanet
planet\name$ = GenerateName(3,8)
planet\Radius =  (4+3*2^(z-1))*10
planet\Aphel =  Rnd(star\habital+0.5,1.1)+olda
planet\perihel = Rnd(star\habital+0.5,1.1)+oldp
planet\sidper = z*100
planet\groesse = Rnd(2,1200)
planet\rot = Rnd(0,255)
planet\gruen = Rnd(0,255)
planet\blau = Rnd(0,255)
olda = planet\aphel
oldp = planet\perihel
Next
Case 3
For z=1 To anz
planet.tplanet = New tplanet
planet\name$ = GenerateName(3,8)
planet\Radius = (4+3*2^(z-1))*10
planet\Aphel = Rnd(0.9,1.1)+olda
planet\perihel = Rnd(0.9,1.1)+oldp
planet\sidper = z*100
planet\groesse = Rnd(2,1200)
planet\rot = Rnd(0,255)
planet\gruen = Rnd(0,255)
planet\blau = Rnd(0,255)
olda = planet\aphel
oldp = planet\perihel
Next
End Select



;Fonts laden
Global font1=LoadFont("System",16,0,0,0)
Global font2=LoadFont("Small Fonts",10,0,0,0)

;Hauptschleife
While Not KeyHit(1)
  mx = MouseX()
  my = MouseY()
    ;Tastatursteuerung
    If KeyDown(208) Then zoom#=zoom#+10
    If KeyDown(200) Then zoom#=zoom#-10
    If KeyDown(205) Then zeit#=zeit#+(zoom#/1000)
    If KeyDown(203) Then zeit#=zeit#-(zoom#/1000)
   
    If KeyDown(57) Then Planetinfo()
    ;Begrenzungen
    If zoom#<25 Then zoom#=25
    If zoom#>4000 Then zoom#=4000
    ;If zeit#<1 Then zeit#=1
    If zeit>1000 Then zeit#=1000
   
    ; Bildschirm leeren
    Cls
   
    ;Planeten
    For planet.Tplanet = Each Tplanet
       
        ;Daten aus den Feldern lesen
        name$=planet\name$
        dist#=Float(planet\radius)/zoom#*100
        aphel#=Float(planet\aphel)
        perihel#=Float(planet\perihel)
        speed#=365.256/Float(planet\sidper)
        size#=Float(planet\groesse)/zoom#
        If size#<5 Then size#=5
        r=Int(planet\rot)
        g=Int(planet\gruen)
        b=Int(planet\blau)
       
        ;aktuellen Planet einzeichnen
        zeichneplanet(mx,my,name$,dist#,aphel#,perihel#,speed#,size#,i#,360,r,g,b,font2)
       
    Next
     ;Sterne
    For star.Tstar = Each Tstar
       
        ;Daten aus den Feldern lesen
        name$=star\name$
        dist#=Float(star\radius)/zoom#*100
        aphel#=Float(star\aphel)
        perihel#=Float(star\perihel)
        speed#=365.256/Float(star\sidper)
        size#=Float(star\groesse)/zoom#
        If size#<5 Then size#=5
        r=Int(star\rot)
        g=Int(star\gruen)
        b=Int(star\blau)
        habit = star\habital
        ;aktuellen Planet einzeichnen
        zeichnestern(mx,my,name$,dist#,aphel#,perihel#,speed#,size#,i#,360,r,g,b,font2)
       Next
   
   
    ;Winkel erhöhen
    i#=i#+zeit#
   
    SetFont font1
   
    ;abgelaufene Zeit in Erdjahren zeigen
    Color 255,255,255
    ;Text 0,0,"Erdumläufe:":Text 100,0,i#/jahr#
    Text 0,15,"Zoom:":Text 100,15,Int(zoom#)
    Text 0,30,"Speed:":Text 100,30,zeit#
   
    ;Bufferswitch
    Flip 1
   
Wend

End



;Planet an einer bestimmten Stelle mit Kreisbahn zeichnen
Function zeichneplanet(mx,my,name$,dist#,aphel#,perihel#,speed#,size#,i#,angle#,r,g,b,font)
   
    ;Vorberechnungen
    radiusx#=dist#*aphel#
    radiusy#=dist#*perihel#   
    i#=i#*speed#
   
    ;mittleren Bahnradius einzeichnen
    Color 32,32,32
    ;Oval mx-(dist#),my-(dist#),dist#*2,dist#*2,0   
   
    ;Ellipsenposition berechnen
    xcos#=Cos#(angle#)
    xsin#=Sin#(angle#)
    tmpx#=Cos#(i#)*radiusx#
    tmpy#=Sin#(i#)*-radiusy#
    x#=tmpx#*xcos#+tmpy*-xsin#
    y#=tmpx#*xsin#+tmpy*xcos#
   
    ;elliptischen Bahnradius einzeichnen
    Color 255,255,255
    Oval mx-radiusx#,my-radiusy,radiusx#*2,radiusy#*2,0
   
    ;Planet auf Ellipsenposition zeichnen
    Color r,g,b
    Oval mx+x#-(size#/2),my+y#-(size#/2),size#,size#,1
    Color 0,255,0
   
   
    ;Planetennamen über dem Objekt einzeichnen
    SetFont font
    Color 255,255,255
    Text mx+x#,my+y#-(size#/2)-5,name$,1,1

End Function

Function zeichnestern(mx,my,name$,dist#,aphel#,perihel#,speed#,size#,i#,angle#,r,g,b,font)
   
    ;Vorberechnungen
    radiusx#=dist#*aphel#
    radiusy#=dist#*perihel#   
    i#=i#*speed#
   
    ;mittleren Bahnradius einzeichnen
    Color 32,32,32
    ;Oval mx-(dist#),my-(dist#),dist#*2,dist#*2,0   
   
    ;Ellipsenposition berechnen
    xcos#=Cos#(angle#)
    xsin#=Sin#(angle#)
    tmpx#=Cos#(i#)*radiusx#
    tmpy#=Sin#(i#)*-radiusy#
    x#=tmpx#*xcos#+tmpy*-xsin#
    y#=tmpx#*xsin#+tmpy*xcos#
   
    ;elliptischen Bahnradius einzeichnen
    Color 255,255,255
    Oval mx-radiusx#,my-radiusy,radiusx#*2,radiusy#*2,0
   
    ;Planet auf Ellipsenposition zeichnen
    Color r,g,b
    Oval mx+x#-(size#/2),my+y#-(size#/2),size#,size#,1

   
    ;Planetennamen über dem Objekt einzeichnen
    SetFont font
    Color 255,255,255
    Text mx+x#,my+y#-(size#/2)-5,name$,1,1
   Color 200,0,0
   
End Function

 Function GenerateName$(min, max)
   Local name$, char, vowel, length
   vowel = Rand(0, 1)
   length = Rand(min, max)
   For x = 1 To length
      vowel = Not vowel
      If vowel
         Repeat
            char = Rand(95, 122)
         Until (char <> Asc("a")) And (char <> Asc("e")) And (char <> Asc("i")) And (char <> Asc("o")) And (char <> Asc("u"))
      Else
         Select Rand(1, 5) 
            Case 1
               char = 97
            Case 2
               char = 101
            Case 3
               char = 105
            Case 4
               char = 111
            Case 5
               char = 117
         End Select
     EndIf
      name = name + Chr(char)
   Next
   name= Replace(name, "q", "qu")
   name= Replace(name, Chr(96), "sch")
   name= Replace(name, Chr(95), "ch")
   name = Upper(Mid(name, 1,1)) + Mid(name,2)
   Return name
End Function

Function Planetinfo()
Cls
SetFont font1
b = 1
For planet.tplanet = Each tplanet
Text 1,b,"Name: "+Planet\name+"            Größe: "+Planet\groesse + "        Entfernung zur Sonne: "+planet\perihel*15000000
If planet\perihel<habit Then
Text 1,B+12,"JO" 
Else
Text 1,B+12,"NO"
End If
b = b + 24
Next
Flip
WaitKey()
FlushKeys()
End Function
Mein Freund und Helfer:
Win7 Home Premium SP1
AMD Athlon II X4 645 3.1GHZ
8GB Ram
64bit

Gehe zu Seite Zurück  1, 2

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group