EasyManua.ls Logo

Commodore 128 - Creating a Sprite Program

Commodore 128
448 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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. Heres the
complete program listing:
5 COLOR 0,1:COLOR 4,l:COLOR
1,2
REM
SET COLORS
10
GRAPHIC 1,1
REM
SET HI-RES GRAPHIC
MODE
15 BOX 1,2,2,45,45
REM PICTURE FRAME
20
DRAW,1,17,10 TO 28,10
TO 26,30 REM
CAR BODY
22
DRAWTO 19,30 TO 17,10
REM CAR BODY
24
BOX 1,11,10,15,18
REM
UPPER LEFT WHEEL
26
BOX 1,30,10,34,18
REM
UPPER RIGHT WHEEL
28
BOX 1,11,20,15,28
REM
LOWER LEFT WHEEL
30
BOX 1,30,20,34,28 REM
LOWER RIGHT WHEEL
32
DRAW 1,26,28 TO 19,28 REM
DRAW GRILLE
34
BOX 1,20,14,26,18,90,1
REM CAR SEAT
36
BOX 1,150,35,195,40,90
,1
REM
WHITE LINES
38
BOX 1,150,135,195,140,
90,
1
REM WHITE LINES
40
BOX 1,150,215,195,220,
90,
1
REM WHITE LINES
42
BOX 1,50,180,300,195
REM FINISH OUTLINE
44
CHAR 1,18,23,"FINISH" REM
DISPLAY FINISH
45
SSHAPE A$,11,10,34,30
REM SAVE PICTURE INTO
A$
50
SPRSAV A$,1
REM
STORE A$ IN SPRITE 1
55
SPRSAV A$,2
REM
STORE A$ IN SPRITE
2
60
SPRITE 1,1,7,0,0,0,0
REM TURN ON SPRITE 1
65
SPRITE 2,1,3,0,0,0,0
REM TURN ON SPRITE 2
70
MOVSPR 1,240,70
REM
SPRITE 1 X=240, Y=
70
80
MOVSPR 2,120,70 REM
SPRITE 2 X=120, Y=70
85
MOVSPR 1,180 #6
REM
MOVE SPR 1 DOWN SCREEN
87
MOVSPR 2,180 #7
REM
MOVE SPR 2 DOWN SCREEN
90
FOR 1 = 1 TO 5000 : NEXT I
99
GRAPHIC 0,1
6-23

Table of Contents

Other manuals for Commodore 128

Related product manuals