mouse movement control and scrolling

  • pandako
  • Born
  • Born
  • pandako
  • Posts: 2

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • pandako
  • Born
  • Born
  • pandako
  • Posts: 2

Post 3+ Months Ago

got it. no need to help anymore.

tnx anyway ^^
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

Glad to see you got it working, haha :lol:

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 31 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.