TGC Codebase Backup



rotate object using mouse by Slayer93

4th Apr 2005 20:10
Summary

you can rotate a box by pushing the mouse botton and move it



Description

you can rotate a box or any object just edit code by pushing the mouse botton and move the mouse left,right,up,down



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `change the object to rotate different objects
make object cube 1,1

`rotate object
do
x=mousex()
y=mousey()
x1=mousemovex()
y1=mousemovey()
if mousex() = x and mousey() = y and mouseclick()=1
if mousex() < x + x1 then turn object left 1,5
if mousey() < x - x1 then turn object right 1,5
if mousex() > x + x1 then pitch object down 1,5
if mousey() > x - x1 then pitch object up 1,5
endif 
sync
loop