TGC Codebase Backup



Move Crosshair with your mouse by Walnoot

11th May 2005 8:44
Summary

Here is a simple way to move your crosshair with mouse



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Insert path to crosshair image !
Load image "...........................\crosshair.png",1
  Sprite 2,Screen Width()/2-16,Screen Height()/2-16,1 ; Hide Sprite 2
    Make Object Box 2,1,1,1
    Position Object 2,Screen Width()/2,Screen Height()/2,0

Do

   REM MOVEMENT
   Position Camera cPx#,cPy#,cPz#
   Position Object 2,crPx#+mousemovex()*ms#,crPy#+mousemovey()*ms#,0
   Paste Sprite 2,crPx#,crPy#
      cPx#=Camera Position x() ; cPy#=Camera Position y() ; cPz#=Camera Position z()
      crPx#=Object Position x(2) ; crPy#=Object Position y(2)
      ms# = 0.6

   SYNC

LOOP