> You would need to use an Xtra to reset the mouse into the center of
> the screen. I don't think it would be possible in shockwave, at least
> with any shockwave safe Xtras I know of.

True, but provided it's not meant for shockwave but a projector, you could
track the mouse movement on an exitFrame, stepFrame or a handler set up in a
timeOut object.

For example, here's a handler I finished writing a few minutes ago. In a
game I'm working on now, I have a police agent moving inside a grid of
roads. When I move the mouse (in this case it's going to be a rollerball),
the direction of movement changes. Otherwise, the agent moves by himself. I
use the setMouse Xtra (thanks Colin for the tip!) to reset the position of
the cursor to the center, each time the cursor runs out of the screen.
This wouldn't be exactly what you need for your own game, since I'm
constraining movement to horizontal or vertical - but it should point you in
the right direction ;)


on exitFrame me

   deltaH =  the mouseH - pcMouse.locH
   deltaV=  the mouseV - pcMouse.locV

  if (the mouseH < 0) or (the mouseH > 800) or (the mouseV < 0) or (the
mouseV > 600) then
    setMouse ((the stage).drawRect.width/2, (the stage).drawRect.height/2)
  end if

  pcMouse = the mouseLoc

  if abs(deltaH) > 10 and abs(deltaH) > abs(deltaV) then
    --   horizontal
    pcVelocity = point (pSpeed * (deltaH.float/abs(deltaH)), 0)
  else
    if abs(deltaV) > 10 then
      --vertical
      pcVelocity = point (0, pSpeed * (deltaV.float/abs(deltaV)))
    end if
  end if

  me.moveAgent (pcVelocity.locH, pcVelocity.locV)

end


Regards,
Karina Steffens,
Lead Programmer

Martello Media Ltd.
4 Islington Avenue
Sandycove
Co. Dublin

Tel: +353 1 2844668
Fax: +353 1 2803195
http://www.martellomm.ie




[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to