Centralia Junior High School
Centralia, Illinois
Math and Computers
(All rights reserved. Do not reproduce without permission.)

An Animated Helicopter created with
Coordinate Graphing, Translation and Reflection
using LOGO

Using pcLogo for Windows, Harvard Associates, Inc.

Click Here to view Logo Procedures for MSW Logo.

The Logo procecures listed here create an animate helicopter with action color and sound to provide a perfect illustration of geometry concepts.


TO P :X :Y
SETXY LIST :D * 6 * :X + :A 6 * :Y + :B
END

TO COPTER
PU P -1 3
PD P -6 3
P 4 3
P -1 3
P -1 2
P -2 1
P 2 1
P -7 1
P -2 0
P -1 -1
P 1 -1
P 2 0
P 2 1
P 1 2
P -1 2
PU P -8 2
PD P -6 0
PU P -8 0
PD P -6 2
END

TO ANIMATE
MAKE "D 1
FLYR -250 200 100
SPINLT 1
FLYL 200 30 100
SETPC 4 ALIEN -260 100
FLYL 30 0 100
SHOOT
SETPC 215 ALIEN -260 100
DESTROY -260 100
SETPC 15 ALIEN -260 100
FLYD 100 -80 0
FLYL 0 -250 -80
FLYU -80 90 -250
SPINRT -1
FLYU 90 100 -250
ANIMATE
END

TO FLYR :X1 :X2 :Y
IF :X1 > :X2 [STOP]
MAKE "A :X1
MAKE "B :Y
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
FLYR :X1 + 3 :X2 :Y
END

TO FLYL :X1 :X2 :Y
IF :X1 < :X2 [STOP]
MAKE "A :X1
MAKE "B :Y
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
FLYL :X1 - 3 :X2 :Y
END

TO FLYD :Y1 :Y2 :X
IF :Y1 < :Y2 [STOP]
MAKE "A :X
MAKE "B :Y1
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
FLYD :Y1 - 3 :Y2 :X
END

TO FLYU :Y1 :Y2 :X
IF :Y1 > :Y2 [STOP]
MAKE "A :X
MAKE "B :Y1
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
FLYU :Y1 + 3 :Y2 :X
END

TO SPINLT :N
IF :N < -1 [STOP]
MAKE "D :N
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
SPINLT :N - 0.40
END

TO SPINRT :N
IF :N > 1 [STOP]
MAKE "D :N
SETPC 0 COPTER
TONE 120 2
SETPC 15 COPTER
SPINRT :N + 0.40
END

TO SHOOT
MAKE "A 0 MAKE "B 100
SETPC 0 COPTER
PU P 2.1 0.40 SETHEADING :D * 90
SETWIDTH 2 SETPC 12
REPEAT 3 [OUT LASER IN]
SETHEADING 0 SETWIDTH 1
END

TO LASER
PLAY "laser.wav ;this file must be present
END

TO EXPLODE
PLAY "explode.wav ;this file must be present
END

TO OUT
PD FD 220
END

TO IN
PE BK 220 WAIT 4 PU
END

TO ALIEN :X :Y
MAKE "A :X
MAKE "B :Y
PU P -2 2
PD P -1.5 3
P 1.5 3
P 2 2
P 0.50 1.6
P -0.50 1.6
P -2 2
P -4 1
P -4 0
P -3 -1
P -1 -1.5
P 1 -1.5
P 3 -1
P 4 0
P 4 1
P 2 2
P 4 1
P 1 0
P -1 0
P -4 1
PU P -1 -2
PD P -1 -3
PU P 0 -2
PD P 0 -3
PU P 1 -2
PD P 1 -3
END

TO DESTROY :X :Y
SETPC 12 BLAST :X :Y
EXPLODE
SETPC 15 BLAST :X :Y
MAKE "A 0 MAKE "B 100
SETPC 15 COPTER
END

TO BLAST :X :Y
MAKE "A :X
MAKE "B :Y
PU P 0 0 PD
REPEAT 12 [FD 24 BK 24 RT 30]
PU P -1 -4 PD P -2 -5
PU P 0 -5 PD P 1 -6
PU P -2 -7 PD FD 2
PU P 0 -7 PD FD 2
PU P 1 -8 PD FD 2
PU P 2 -5 PD FD 2
END


Type ANIMATE in the listener window after defining the procedures in the editor window.


[ Return to Main Logo Page ] [ Return to CJHS Page ]