Verfolger zählen
Übersicht

dreamfileBetreff: Verfolger zählen |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hallo,
ich habe eine Verfolgung programmiert, eine Art Magnet. Ich möchte alle Bälle die mir folgen zählen, wenn ein Ball einen bestimmten Abstand hinter mir ist, verliere ich ihn wieder, das ist absicht. Wie bekomme ich es hin immer die aktuelle Anzahl der mir folgenden Bälle anzuzeigen ? Vielen Dank schonmal !!! LG Sascha Code: [AUSKLAPPEN] Graphics3D 800,600,32,2 schrift=LoadFont("Arial",14,True,False,False) Collisions 2,1,2,2 ; Player -> plane Collisions 2,3,2,2 ; Player -> Bälle Collisions 3,1,2,2 ; Bälle -> plane Collisions 3,2,2,2 ; Bälle -> Player Collisions 3,3,2,2 ; Bälle -> Bälle gravy#=-.55 plane=CreatePlane() PositionEntity plane,0,0,0 EntityColor plane,0,16,39 EntityAlpha plane,0.85 EntityType plane,1 mirror=CreateMirror() play=CreateSphere( 8 ) PositionEntity play,0,100,0 EntityShininess play,1 EntityPickMode play,2 ScaleEntity play,2,2,3 EntityRadius play,2 EntityType play,2 Dim ball(41) Dim abstand(41) Dim pfosten(41) a=1 b=1 c=1 For w=1 To 2000 Step 50 ball(a)=CreateSphere( 4 ) PositionEntity ball(a), Rand(-250,250),100,Rand(-250,250) ScaleEntity ball(a),1,1,1 EntityRadius ball(a),1 abstand(b)=EntityDistance(play,ball(a)) EntityType ball(a),3 a=a+1 b=b+1 c=c+1 Next AmbientLight 255,255,255 light=CreateLight() RotateEntity light,90,0,0 PositionEntity light,0,20,0 target=CreatePivot() PositionEntity target,0,0,-2 camera=CreateCamera(play) CameraClsColor camera,40,40,200 PositionEntity camera, 0,5,-20 RotateEntity camera,0,0,0 cam1=CreateCamera() : PositionEntity cam1,0,250,0 : CameraViewport cam1,5,5,395,200 CameraClsColor cam1,40,40,200 cam2=CreateCamera(play) : PositionEntity cam2,0,.5,0 : CameraViewport cam2,405,5,395,200 CameraClsColor cam2,40,40,200 : RotateEntity cam2,0,180,0 AnfangZeit = MilliSecs() AnfangZeit2 = MilliSecs() speed#=0 txt=0 While Not KeyHit(1) ; BEGINN SCHLEIFE pos=MouseZ() Mod 10 abstand_cam#=EntityDistance(play,cam1)/200 a=1 : b=1 For w=1 To 2000 Step 50 Winkel#=DeltaYaw# (ball(a),play) abstand(b)=EntityDistance(play,ball(a)) If abstand(b)=< 50 Then MoveEntity ball(a),0,0,.99 If EntityCollided( play,3 ) txt=txt+1 Else txt=txt EndIf If abstand(b)=< 50 Then EntityColor ball(a),0+(abstand(b)*4),255-(abstand(b)*4),0 If abstand(b)=< 50 Then EntityColor play,0+(abstand(b)*4),255-(abstand(b)*4),0 If abstand(b)=< 50 Then zahl=zahl01 If abstand(b)=< 51 Then TurnEntity ball(a),0,winkel,0 If abstand(b)=> 101 Then EntityColor ball(a),255,255,255 TranslateEntity ball(a),0,gravy,0 abstand_b#=abstand(b) a=a+1 b=b+1 Next EndeZeit = MilliSecs() Flipdauer# = (EndeZeit - AnfangZeit) / 1000.0 AnfangZeit = EndeZeit Spanne = EndeZeit - AnfangZeit2 Sekunde = (Spanne/1000) Mod 60 Minuten = (Spanne/1000/60) Hund# = Spanne Mod 1000 mx=MouseX()-400 my=MouseY()-300 If MouseHit(1) richtung#=0 EndIf If KeyDown(203) richtung#=richtung+.01 If KeyDown(205) richtung#=richtung-.01 If KeyDown(200) speed#=1 If KeyDown(208) speed#=0 MoveEntity play,0,0,speed TurnEntity play,0,richtung,0 TranslateEntity play,0,gravy,0 PointEntity camera,play PointEntity cam1,play CameraZoom cam1,abstand_cam UpdateWorld RenderWorld Oval mx-5+400,my-5+300,10,10,1 Color 0,255,0 Oval 400-(richtung*100),220,10,10,1 Color 255,255,255 SetFont schrift Text 10,10, "Zeit: "+minuten+":"+sekunde Text 10,30, "a und b "+a+" / "+b+" / "+c Text 10,50, ""+zahl Text 10,70, "" Text 10,90, "feind: "+txt Text 10,110, "" Text 10,130, "w= "+w Text 10,150, "abstand_b: "+abstand_b Flip 0 Wend End |
||
Der Neue |
![]() |
biggicekey |
![]() Antworten mit Zitat ![]() |
---|---|---|
für jeden ball der innerhalb einer bestimmten entfernung ist, was du ja eh überprüfst, zählst du einen zähler eins weiter. dann kannst du dir die zahl anzeigen lassen. zu beginn der schleife musst du den zähler wieder auf 0 setzen.
so würde ich es machen |
||
#45 www.icekeyunlimited.de www.starcrusade.de
Gewinner BCC#17 !!! mit dotkiller Nothing more to register - you've cleaned us out![/size] |
dreamfile |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
"Manchmal kann es so einfach sein"
DANKE |
||
Der Neue |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group