CodeBase - simple box movement

Return to the CodeBase listing

Category: Basic 2D

Version: 1.0

0
0

Information

Uploaded: 12th Aug 2005 20:41

Modified: 1st Jan 1970 01:00

Author:  blood scent

Summary

moves a box around without sprite use

Full Description

randomize timer<br /> rem setup positions<br /> set display mode 640,480,16<br /> x#=0<br /> y#=0<br /> x2#=10<br /> y2#=10<br /> rem setup box to control<br /> box x#,y#,x2#,y2#<br /> boxcolor=rgb(rnd(255),rnd(255),rnd(255))<br /> rem main game loop<br /> do<br /> boxcolor=rgb(rnd(255),rnd(255),rnd(255))<br /> rem move left<br /> if leftkey()=1 and x#&gt;0<br /> cls<br /> x#=x#-1<br /> x2#=x2#-1<br /> box x#,y#,x2#,y2#<br /> endif<br /> rem move right<br /> if rightkey()=1 and x2#&lt;640<br /> cls<br /> x2#=x2#+1<br /> x#=x#+1<br /> box x#,y#,x2#,y2#<br /> endif<br /> rem move down<br /> if downkey()=1 and y2#&lt;480<br /> cls<br /> y#=y#+1<br /> y2#=y2#+1<br /> box x#,y#,x2#,y2#<br /> endif<br /> rem move up<br /> if upkey()=1 and y#&gt;0<br /> cls<br /> y#=y#-1<br /> y2#=y2#-1<br /> box x#,y#,x2#,y2#<br /> endif<br /> ink boxcolor,0<br /> loop

Comments

No comments yet.