Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description: "Adds a ghost and moves it."
- author: "Philipp Schaad"
- date: "19.11.2014"
- revision: "1.0"
- class
- GHOST
- inherit
- MOBILE
- create
- make
- feature -- Create
- make (s: STATION; r: REAL_64)
- do
- radius_length := r
- orbit_station := s.position
- create orbit_radius.make (r, 0)
- position := orbit_station + orbit_radius
- end
- feature -- Constants
- speed: REAL_64
- -- Speed of the ghosts
- do
- Result := 20
- end
- feature -- Attributes
- orbit_station: VECTOR
- -- Orbit station held as a vector
- orbit_radius: VECTOR
- -- Orbit radius held as a vector
- radius_length: REAL_64
- feature -- Calculate
- position: VECTOR
- -- Ghosts Position
- move_distance (d: REAL_64)
- -- Distance to move
- local
- angle_turn: REAL_64
- do
- angle_turn := d / radius_length
- orbit_radius := orbit_radius.rotated (angle_turn)
- position := orbit_station + orbit_radius
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement