A new player control concept

Well, I don't know if it's really new or some of you already saw it elsewhere... but I've never seen this way to control the player

It works this way: you move the mouse pointer. When you click the mouse, the player will move in the opposite direction of your mouse pointer. The closer the pointer, the slower the movement.

It's just a prototype, but remember that BallBalance was started from this prototype and ended with this sponsorship...

ACTIONSCRIPT:
  1. _root.attachMovie("ball", "ball", _root.getNextHighestDepth(), {_x:250, _y:200});
  2. _root.attachMovie("pnter", "pnter", _root.getNextHighestDepth(), {_x:250, _y:200});
  3. moving = false;
  4. Mouse.hide();
  5. pnter.onEnterFrame = function() {
  6.     this._x = _xmouse;
  7.     this._y = _ymouse;
  8. };
  9. ball.onEnterFrame = function() {
  10.     dist_x = this._x-_root._xmouse;
  11.     dist_y = this._y-_root._ymouse;
  12.     total_dist = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
  13.     angle = Math.atan2(dist_y, dist_x);
  14.     this.arrow._rotation = angle*57.2957795;
  15.     if (moving) {
  16.         dir = this.arrow._rotation;
  17.         xspeed = total_dist/25*Math.cos(dir*0.0174532925);
  18.         yspeed = total_dist/25*Math.sin(dir*0.0174532925);
  19.     }
  20.     this._x += xspeed;
  21.     this._y += yspeed;
  22.     xspeed *= 0.9;
  23.     yspeed *= 0.9;
  24. };
  25. _root.onMouseDown = function() {
  26.     moving = true;
  27. };
  28. _root.onMouseUp = function() {
  29.     moving = false;
  30. };

and the result is...

Download source code and make something decent.

Improve the blog rating this post
Tell me what do you think about this post. I'll write better and better entries.
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5 out of 5)
Loading ... Loading ...

» Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.

23 Responses to “A new player control concept”

  1. David on March 5th, 2008 9:32 pm

    Never seen that before… But its awesome! I really like it.

  2. Jack Hopkisn on March 5th, 2008 11:30 pm

    Pretty cool!
    Are you going to make a game around it?

  3. Emanuele Feronato on March 5th, 2008 11:41 pm

    SURE!

  4. Re2deemer on March 5th, 2008 11:48 pm

    Interesting, never seen a controlling system like that.

    What are the 57.2957795 and 0.0174532925 for, why use such numbers?

  5. Emanuele Feronato on March 5th, 2008 11:56 pm

    I use them to quicky convert radians to degrees and degrees to radians.

    Just google for “radians to degrees”

  6. Mike on March 6th, 2008 12:33 am

    That’s interesting.

    It seems sort of counter intuitive… But I guess it depends on what you do with it.

    If you used exactly the same principle, but made the avatar move closer to the pointer, it’d feel a lot more natural.

    That said, it’s not too hard to get use to. So, if you have a cool game, people will probably just stick around long enough that it begins to feel more natural.

    The way things move sort of feels like you are a cloud or something blowing a boat…
    But if you were going to do that, it would probably feel far more natural to have it move faster the closer you are, rather than the further you are…

    -Mike

  7. JDog on March 6th, 2008 12:34 am

    Sorry to be so annoying Emanuele, but did you check your emails ? Because I require some help that only you may offer the solution to !

    As far as your prototype is concerned ! You need to make a game out of it, but other than a coin collect game I can’t see what you would do…

    Or perhaps a maze game, where you get punished for touching the edges, It could be a better mouse follow game but you have precision control over movement, where the control scheme makes sense. You could guide a mouse to some cheese, past obstacles and the like !

  8. Adam Owen on March 6th, 2008 12:46 am

    While this system isn’t new (minigolf games?) I’ve never seen it used to control a player.

    It’d be interesting to see how someone would actually use it to control a human, I couldn’t see it being used for anything other than puzzle games though?

  9. Kesh on March 6th, 2008 1:39 am

    pi/180 and 180/pi to convert radians and degrees.

  10. Thomas on March 6th, 2008 6:51 am

    I think that I might make a boat racing game or something out of this!

  11. Monkios on March 6th, 2008 3:58 pm

    Like Adam Owen said, this looks a lot like a minigolf startup.

    With some bouncing physics, this could be cool.

  12. Xodus on March 6th, 2008 5:24 pm

    You know, if u more the ball too far out of the screen, its impossible to get it back in, so mabye a control type game would be good for this, with gravity and all?

  13. Tom on March 8th, 2008 11:34 am

    I did something like this in a very early prototype for a pool game. The small red circle mouse cursor was a pool cue which rotated around the white ball and moved with certain limits away from the white with the mouse to set the power. Never got any further than this demo cos I was starting on the collision detection when other work came along. Maybe one day…

  14. Flasher on March 9th, 2008 8:56 pm

    This is like Rubilon’s Rumble Ball 3, but without the powering-up gauge. Very usable.

  15. David on March 10th, 2008 6:57 pm

    Hey uhm.. Now I’ll sound a bit… Really sucky :P, but, how would you add a hit test between this and something? Like this “ball” and a wall. Any help is wanted!

  16. UnknownFury on March 10th, 2008 11:31 pm

    Would it not be easier to multiple by Math.PI/180 and 180/Math.PI to convert radians to degrees and vise versa rather than having to type out that long number? Is it just personal preference or what?

    UnknownFury

  17. Emanuele Feronato on March 11th, 2008 11:09 am

    Fury: of course I can use Math function but it’s faster (for the CPU) having a preset value instead of calculating it a million times.

  18. Luiz Fernando on March 12th, 2008 3:11 am

    instead of using onMouseDown and onMouseUp, you can use onPress and onRelease

  19. EagleVision on March 12th, 2008 8:26 pm

    JDog:

    If you need any help, ask me…I might be able to help you.

    But it seems as you already got help.

  20. Lawrie on March 28th, 2008 1:45 pm

    Interesting, I used a similar system for one of my games a while ago.
    It’s based around making a character avoid other balls, so the strange feeling of having the character move away from the mouse kind of works.

    Its at - http://www.lawriecape.co.uk/avoidgame/ if you fancy a look.

  21. sam on April 7th, 2008 11:24 pm

    hi, if you hold down left click then the ball will carry on moving, and gradually accelerating, this could become an easy to play racing game and you would only have to add bounds to the race track.

  22. kist on May 22nd, 2008 3:23 pm

    this could make a nice top-view car game, because you can control speed and turn with ease! great work!

  23. Danion on June 19th, 2008 1:46 pm

    hi,

    This looks awesome, but i only want to know one thing,
    I ticked the entire ac myself, just to learn the typing and more, but, i also dl’ed the source.
    When i open that source, i dont see any objects in de main window, when i previeuw the movie, i see the ball and pointer..

    Strange??

    regards

Leave a Reply