Creating A Sprite Program - Commodore 128 System Manual

Hide thumbs Also See for 128:
Table of Contents

Advertisement

Now RUN the entire program with all the steps included. You
have just written your first sprite program. You have created a
raceway with two racing cars. Try adding more cars and more
objects on the screen. Experiment by drawing other sprites and
include them in the raceway. You are now well on the way in
sprite programming. Use your imagination and think of other
scenes and objects you can animate. Soon you can create all
kinds of animated computer " movies."
To stop the sprites, press RUN/STOP and RESTORE at the same
time.

Creating a Sprite Program

You now have a working sprite program example. Here's the
complete program listing:
5 C O L O R 0 , 1 : C O L O R 4 , l : C O L O R
10 G R A P H I C
1,1
15 B O X 1 , 2 , 2 , 4 5 , 4 5
20 D R A W , 1 , 1 7 , 1 0 TO 2 8,10 TO 26,30 R E M C A R B OD Y
22 D R A W T O
19,30 TO 17, 10
24 B O X
1 , 1 1 , 1 0 , 1 5 , 1 8
26 B O X
1 , 3 0 , 1 0 , 3 4 , 1 8
28 B O X 1 , 1 1 , 2 0 , 1 5 , 2 8
30 B O X 1 , 3 0 , 2 0 , 3 4 , 2 8
32 D R A W 1 , 2 6 , 2 8
34 B O X 1 , 2 0 , 1 4 , 2 6 , 1 8 , 9 0 , 1
36 B O X 1 , 1 5 0 , 3 5 , 1 9 5 , 4 0 , 9 0 ,1
38 B O X 1 , 1 5 0 , 1 3 5 , 1 9 5 , 1 4 0 , 90, 1
40 B O X 1 , 1 5 0 , 2 1 5 , 1 9 5 , 2 2 0 , 90, 1
42 B O X 1 , 5 0 , 1 8 0 , 3 0 0 , 1 9 5
44 C H A R
1 , 1 8 , 2 3 , " F I N I S H "
45 S S H A P E A $ , 1 1 , 1 0 , 3 4 , 3 0
50 S P R S A V A $ ,1
55 S P R S A V A $ ,2
60 S P R I T E
1 , 1 , 7 , 0 , 0 , 0 , 0
65 S P R I T E
2 , 1 , 3 , 0 , 0 , 0 , 0
70 M O V S P R
1 , 2 4 0 , 7 0
80 M O V S P R
2 , 1 2 0 , 7 0
85 M O V S P R
1 ,180
87 M O V S P R
2,180
90 FO R
1 = 1 TO 5000 : N E X T
99 G R A P H I C
0,1
1,2
TO 19,28
#6
#7
I
R E M SET C O L O R S
R E M SET H I - R E S G R A P H I C M O D E
R EM P I C T U R E F R A M E
R E M CA R B O D Y
R E M U P P E R L EF T W H E E L
R E M U P P E R RI G H T W H E E L
R E M L O W E R L EF T W H E E L
R E M L O W E R R I G H T W H E E L
R E M D R A W G R I L L E
RE M C A R SEAT
RE M W H I T E
LI NE S
R E M W H I T E
L INES
R E M W H I T E
L INES
R E M F I N I S H O U T L I N E
R E M D I S P L A Y F I N I S H
R E M S AV E P I C T U R E
R E M S T O R E A$
IN S P R I T E
R E M S T O R E A$
IN S P R I T E
R E M TU R N ON S P R I T E
R E M T U R N ON S P R I T E
R E M S P R I T E
1 X = 2 4 0 , Y= 70
R E M S P R I T E
2 X = 1 2 0 , Y= 70
R E M M O V E
SPR 1 D O W N
R E M M O V E
SPR 2 D O W N S C R E E N
INTO A$
1
2
1
2
S C R E E N
6-23

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

128d

Table of Contents