TGC Codebase Backup



Move Sprites Ways... by Sergey K

28th Jan 2005 16:18
Summary

few ways how to move sprites..



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    load image "sprite.png",1


`---------------Way 1---------------
left = 10
right = 10

do
if leftkey()=1 then left = left + 1
if rightkey()=1 then left = left - 1
if upkey()=1 then left = right + 1
if downkey()=1 then left = right - 1
sprite 1,left,right,1
loop


`-------------------Way 2------------------
X = 10
Y = 10

do
if leftkey()=1 then inc X,1
if rightkey()=1 then dec X,1
if upkey()=1 then inc Y,1
if downkey()=1 then dec X,1
sprite 1,X,Y,1
loop


`-------------------Way 3------------------
X = 10
Y = 10

do
if leftkey()=1 then inc X,1
if rightkey()=1 then inc X,-1
if upkey()=1 then inc Y,1
if downkey()=1 then inc X,-1
sprite 1,X,Y,1
loop


`-------------------Way 3------------------
X = 10
Y = 10

do
if leftkey()=1 then dec X,1
if rightkey()=1 then dec X,-1
if upkey()=1 then dec Y,1
if downkey()=1 then dec X,-1
sprite 1,X,Y,1
loop