TGC Codebase Backup



move object function by blood scent

17th Aug 2005 19:46
Summary

a function for you to use on your objects for motion



Description

you must have an object that it numbered 1,or fix the code



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    function moveobject
do

rem turns object
if leftkey()=1 then turn#=turn#-3.0
if rightkey()=1 then turn#=turn#+3.0
turn#=wrapvalue(turn#)

rem moves up and down
if upkey()=1 then x#=newxvalue(x#,turn#,0.1) : z#=newzvalue(z#,turn#,0.1)
if downkey()=1 then x#=newxvalue(x#,turn#,-0.1) : z#=newzvalue(z#,turn#,-0.1)

rem positions object and rotates it
position object 1,x#,0.0,z#
yrotate object 1,a#
loop