mouse movement control and scrolling

  • pandako
  • Born
  • Born
  • No Avatar
  • Joined: Aug 23, 2007
  • Posts: 2
  • Status: Offline

Post August 23rd, 2007, 9:59 am

hi, i have a problem.
i am a total beginner in any programing.
i started making game, in which main char will be centered on the screen and surrounding will scroll as he moves. You will control his moving with mouse, when the mouse button is pressed he will move in direction of mouse cursor with speed determined by mouse cursor distance from main char.
my code is:
onClipEvent(load)
{
xspeed = 0;
yspeed = 0;


onClipEvent(enterFrame)
{
onMouseDown = function()
{
xspeed = (xspeed - (this._x - _root._xmouse))*0.1;
yspeed = (yspeed - (this._y - _root._ymouse))*0.1;
}
onMouseUp = function()
{
xspeed = 0
yspeed = 0

}
_root.level._x -=xspeed;
_root.level._y -=yspeed;
}

however, he moves only when u press the button. But i want him to change direction/speed as you hold pressed mouse button and move mouse around.
How can i make this happen?
tnx
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 23rd, 2007, 9:59 am

  • pandako
  • Born
  • Born
  • No Avatar
  • Joined: Aug 23, 2007
  • Posts: 2
  • Status: Offline

Post August 23rd, 2007, 2:33 pm

got it. no need to help anymore.

tnx anyway ^^
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6134
  • Loc: Seattle, WA
  • Status: Offline

Post August 23rd, 2007, 9:53 pm

Glad to see you got it working, haha :lol:
The Beer Monocle. Classy.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 25 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.