Sign in to follow this  
Followers 0
BrettF

Trying to Make a Game....

6 posts in this topic

Hi....

I'm attempting to make a shooting game (like Duck Hunt) I'm trying to implemet different things....

But first: My questions:

How can I get the centre of an image (a gif), to follow the mouse??? I have done a search but nothing turned up well....

Thanks,

Share this post


Link to post
Share on other sites



Why not just change the mousepointer ???


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>


$Main = GUICreate("Game",800,600)

GUICtrlCreateButton("Press ESC to close",300,200,200,200)

$ImageWidth = 68
$ImageHeight = 71
$ImageFile = @Systemdir & "\oobe\images\merlin.gif"

$Crosshair = GUICreate("Crosshair", 68, 71, 10, 10,$WS_POPUP,$WS_EX_LAYERED,$Main)
GUICtrlCreatePic($ImageFile,0,0, $ImageWidth,$ImageHeight)

GUISetState(@SW_SHOW,$Main)
GUISetState(@SW_SHOW,$Crosshair)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    UpdateCrosshair()
    Sleep(10)
WEnd

Func UpdateCrosshair()
    $Mouse = MouseGetPos()
    If Not @error Then
        WinMove($Crosshair,"",$Mouse[0]-($ImageWidth/2), $Mouse[1]-($ImageHeight/2))
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0