[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stars (like "Warp Screen Saver") Project



If you've got a cool project that you've made with StarLogo, please
post it to starlogo-users@media.mit.edu! There are plenty of
interested people waiting to hear new ideas!


Andrew Begel
Epistemology and Learning
MIT Media Lab

--------- Forwarded Message  --------------------
Date: Sat, 14 Jun 1997 18:46:29 -0400
From: cb@alife.fusebox.com (Bob Silverman)
Subject: Stars (like "Warp Screen Saver") Project


Here is a neat little project that does your basic flight through the
Galaxy. 2.0 rules!

Bob

----------------------------cut here-----------------------------
;  copyright 1997, Robert H. Silverman
;           cb@fusebox.com

;            \o/   evolve
;             |      or
;            / \    die.

; http://alife.fusebox.com/cb/alife.html
;
;;-;-;--;---;----;-----;------;-------;

turtles-own [veloc shooter?]
;;----------------------------------------------------------------------------;;
;; veloc      = star's velocity
;; shooter?   = shooting star or not

globals [maxdist]
;;----------------------------------------------------------------------------;;
;; maxdist    = farthest point from (0, 0)


to setup
;;----------------------------------------------------------------------------;;
  setmaxdist sqrt ((screen-edge ^ 2) + (screen-edge ^ 2))
  ca crt stars
  reset-star
  
end

to reset-star
;;----------------------------------------------------------------------------;;
  setc black
  seth random 360
  
  setshooter? ((random (11 - shoot) * 10) = 0)
  ifelse shooter?
  	[setc red setxy random screen-size random screen-size]
  	[setxy 0 0]
  	
  jump random 20
  
  setveloc .010 + (5 + random 20) / 1000
  
end

to go
;;----------------------------------------------------------------------------;;
  setveloc veloc + veloc * (accel / 1000)
  fd veloc
  
  if not shooter?
  	[scale-color black (distance 0 0) 0 maxdist]
  	
  if ((abs xcor) > (screen-size / 2 - 2)) or ((abs ycor) > (screen-size / 2 - 2))
     [reset-star]
     
end
@#$#@#$#@
BUTTON
10
46
88
75
button2
go
T
2
NIL

BUTTON
10
9
70
39
button1
setup
NIL
1
NIL

SLIDER
96
14
186
39
slider1
stars
10
200
154
3

SLIDER
97
47
187
72
slider2
accel
1
20
11
2

SLIDER
97
80
187
105
slider3
shoot
1
10
1
1

@#$#@#$#@
WHAT IS IT?
-----------
Simulating flight through space.

HOW TO USE IT
-------------
Set the number of stars and click the SETUP button to blast
off.  (Note: After a few seconds, star births will be more
randomly distributed.)

The accel slider controls how fast the stars appear to 
be coming at you.

The shoot slider controls the chance of a star "shooting".

THINGS TO NOTICE
----------------
Stars get brighter as the come closer to you.
Stars have a 1 in (11-shoot)*10 chance of "shooting".
@#$#@#$#@
StarLogo 2.0
@#$#@#$#@
(install-shapenames 'NIL)
@#$#@#$#@
@#$#@#$#@


------- End of Forwarded Message