TGC Codebase Backup



timer based movement for begginers by Alastair Zotos

29th Nov 2003 7:45
Summary

movement with an object while controlling the camera



Description

timer based movement for begginers



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `Setup sync
sync on
sync rate 300

`create a cube to spin
make object cube 1,50

`start off timer
timer=1

`main loop
do

`make timer increase
inc timer

`if the timer goes over 10 then shift it back to 1
if timer>10 then timer=1

`tell waht to do and when to do it
if timer=1 then yrotate object 1,36
if timer=2 then xrotate object 1,72
if timer=3 then yrotate object 1,108
if timer=4 then xrotate object 1,144
if timer=5 then yrotate object 1,180
if timer=6 then xrotate object 1,144
if timer=7 then yrotate object 1,108
if timer=8 then xrotate object 1,72
if timer=9 then yrotate object 1,36

`control camera
if upkey()=1 then move camera 10
if downkey()=1 then move camera -10
if leftkey()=1 then turn camera left 1
if rightkey()=1 then turn camera right 1

`refresh screen
sync


`end loop
loop