EasyManua.ls Logo

Commodore 128 - Page 128

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...
The following program is an example of adjoining sprites. The
program creates an outer space environment. It draws stars,
a planet and a spacecraft similiar to Apollo. The spacecraft is
drawn, then stored into two data strings, A$ and B$. The front
of the spaceship, the capsule, is stored in sprite 1. The back
half of the spaceship, the retro rocket, is stored in sprite 2.
The spacecraft flies slowly across the screen. Since it is
traveling so slowly and is very far from Earth, it needs to be
launched earthward with the retro rockets. After a while, the
retro rockets fire and propel the capsule safely toward Earth.
Heres the program listing:
5 COLOR 4,1 : COLOR 0,1:COLOR 1,2 : REM SELECT COLORS
10 GRAPHIC 1,1 : REM SET HI-RES MODE
17 FOR 1=1 TO 40
18 X=INT (RND (1)*320)+1
19 Y=INT (RND (1)*200)+1
21 DRAW 1, X, Y : NEXT I : REM DRAW STARS
22 BOX 0,0,5,70,40,,1 : REM CLEAR BOX
23 BOX 1,1,5,70,40:COLOR 1,8 : REM BOX-IN SPACESHIP
24 CIRCLE1,190,90,35,25:PAINTl,190,95:REM DRAW AND PAINT PLANET
25 FOR 1=90 TO 96 STEP 3:CIRCLE 1,190, 1 ,65,10 : NEXT I
26 DRAW 1,10,17TO16,17TO32,10TO33,20TO32,30TO16,23TO10,23TO10,17
28 DRAW 1,19,24TO20,21T027,25TO26, 28 : REM BOTTOM WINDOW
35 DRAW 1,20,19TO20,17TO29,13TO30,18TO28, 23TO20,19 : REM TOP WINDOW
38 PAINT 1,13,20 : REM PAINT SPACESHIP
40 DRAW 1,34,10TO36,20TO34,30TO45,30TO46,20TO45,10TO34,10
42 DRAW 1,45,10TO51,12TO57,10TO57,17TO51,15TO46,17 : REM ENGINE 1
43 DRAW 1,46,22TO51,24TO57,22TO57,29TO51,27TO45,29:REM ENGINE 2
44 PAINTl,40,15 :PAINTl,47,12 :PAINTl,47,26:DRAW0,45,30TO46,20TO45,10
45 DRAW 0,34,14TO44,14:DRAW 0,34,21T044,21 : DRAW 0, 34, 28T044,28
47 SSHAPE A$,10,10,33,32
48 SSHAPE B$,34,10,57,32
50 SPRSAV A$,1
55 SPRSAV B$,2
60 SPRITE 1,1,3,0,0,0,0
65 SPRITE 2,1,7,0,0,0,0
82 MOVSPR 1,150,150
83 MOVSPR 2,172,150
85 MOVSPR 1,270 #5
87 MOVSPR 2,270 #5
90 FOR 1 = 1 TO 5000 : NEXT I
92 MOVSPR 1,150,150
93 MOVSPR 2,174,150
95 MOVSPR 1,270 #10
96 MOVSPR 2,90 #5
97 FOR 1=1 TO 1200 : NEXT I
98 SPRITE 2,0
99 FORI=1 TO 5000 : NEXT I
100 GRAPHIC 0,1
: REM SAVE SPRITE IN A$
: REM SAVE SPRITE IN B$
: REM SPRITEl DATA
: REM SPRITE2 DATA
: REM ENABLE SPRITE 1
: REM ENABLE SPRITE 2
: REM POSITION SPRITEl
: REM POSITION SPRITE2
: REM ANIMATE SPRITEl
: REM ANIMATE SPRITE2
: REM RETRO POSITION
: REM SPLIT SPRITES 1 & 2
: REM TURN OFF SPRITE 2
: REM RETURN TO TEXT
IN RED
IN BLUE
6-30

Table of Contents

Other manuals for Commodore 128

Related product manuals