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:
-
_root.attachMovie("ball", "ball", _root.getNextHighestDepth(), {_x:250, _y:200});
-
_root.attachMovie("pnter", "pnter", _root.getNextHighestDepth(), {_x:250, _y:200});
-
moving = false;
-
Mouse.hide();
-
pnter.onEnterFrame = function() {
-
this._x = _xmouse;
-
this._y = _ymouse;
-
};
-
ball.onEnterFrame = function() {
-
dist_x = this._x-_root._xmouse;
-
dist_y = this._y-_root._ymouse;
-
total_dist = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
-
angle = Math.atan2(dist_y, dist_x);
-
this.arrow._rotation = angle*57.2957795;
-
if (moving) {
-
dir = this.arrow._rotation;
-
xspeed = total_dist/25*Math.cos(dir*0.0174532925);
-
yspeed = total_dist/25*Math.sin(dir*0.0174532925);
-
}
-
this._x += xspeed;
-
this._y += yspeed;
-
xspeed *= 0.9;
-
yspeed *= 0.9;
-
};
-
_root.onMouseDown = function() {
-
moving = true;
-
};
-
_root.onMouseUp = function() {
-
moving = false;
-
};
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.
Tell me what do you think about this post. I'll write better and better entries.
» 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.
They can be easily customized to meet the unique requirements of your project.
23 Responses to “A new player control concept”
Leave a Reply

Never seen that before… But its awesome! I really like it.
Pretty cool!
Are you going to make a game around it?
SURE!
Interesting, never seen a controlling system like that.
What are the 57.2957795 and 0.0174532925 for, why use such numbers?
I use them to quicky convert radians to degrees and degrees to radians.
Just google for “radians to degrees”
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
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 !
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?
pi/180 and 180/pi to convert radians and degrees.
I think that I might make a boat racing game or something out of this!
Like Adam Owen said, this looks a lot like a minigolf startup.
With some bouncing physics, this could be cool.
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?
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…
This is like Rubilon’s Rumble Ball 3, but without the powering-up gauge. Very usable.
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!
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
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.
instead of using onMouseDown and onMouseUp, you can use onPress and onRelease
JDog:
If you need any help, ask me…I might be able to help you.
But it seems as you already got help.
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.
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.
this could make a nice top-view car game, because you can control speed and turn with ease! great work!
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