The Daily Click ::. Forums ::. Klik Coding Help ::. Mouse Controlled Game
 

Post Reply  Post Oekaki 
 

Posted By Message

eX Com



Registered
  15/08/2002
Points
  352
13th September, 2007 at 20:16:30 -

I'm trying to make a mouse controlled maze type game where the Cursor actually bounces off the walls. I played a flash game like this a while back. Problem is, if I move the mouse even slightly fast, it will go right through the wall. I've tried Fastloop and still doesn't work as well as I would like. Is it hopeless? I'm using MMF2.

 
The chickens are coming...

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
13th September, 2007 at 20:37:07 -

It should work with fast loop. You did put in the condition "not overlapping" in the loops right?

 
-

eX Com



Registered
  15/08/2002
Points
  352
13th September, 2007 at 22:50:15 -

yep. It works a bit... i guess it just can't be detected when you move the mouse quickly... if someone could make a quick example of how to do it I would really appreciate it..

 
The chickens are coming...

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
13th September, 2007 at 22:57:28 -

o.k. ...working on it... could i see a link to the flash game,

 
-

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
13th September, 2007 at 22:58:18 -

Well, you won't be able to do it by simply testing the mouse's position. You'll have to determine its speed, and from that do the appropriate collision tests.

 
Go Moon!

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
13th September, 2007 at 23:44:02 -

OK I made an example. http://www.esnips.com/doc/6a3e178d-39b8-4a00-960a-529c2b0a96b5/mouse-move-tutorial

its a bit too sensitive for my taste but i didn't know how else to do it

 
-

eX Com



Registered
  15/08/2002
Points
  352
14th September, 2007 at 12:24:05 -

wow thanks alot. It would be perfect if the object could like slide up the sides of the walls. Right now if you try to do that it is just sort of stuck in one place. But its still amazing thanks alot. If anyone can figure out a way to do the sliding thing and keep this engine you get 2 gold stars.

 
The chickens are coming...

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
14th September, 2007 at 12:27:26 -

Using a fastloop should work, as long as you "draw a line" between the old and the new position, and check every part in this path until it's at the end.

The linear formula in the bézier curve tutorial can help you finding the line and each seperate position.

 
Old member (~2004-2007).

eX Com



Registered
  15/08/2002
Points
  352
14th September, 2007 at 12:29:59 -

I'll try it out but it sounds a little too complicated for me. Also, why can't I do a left-click event when I have a mouse controlled object. Is there a way around this? Later on, I want the object to shoot something every time you click. But unless I do repeat while clicking, it doesnt work.

Image Edited by the Author.

 
The chickens are coming...

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
14th September, 2007 at 15:15:14 -

An object with mouse movement uses "button 1" and "button 2" for mouse clicks.

EDIT: btw, what I was talking about before just tried to make sure it'll move one step closer to the mouse's new position, while still checking collisions and stuff. Get it to react inside the loop as soon as possible by stopping the loop when it's overlapping a wall, and do some other actions that would reverse the ball or whatever.

Image Edited by the Author.

 
Old member (~2004-2007).

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4075

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
14th September, 2007 at 16:16:49 -

I fixed it, so that it will slide on the walls. http://www.esnips.com/doc/98629f37-6014-4b12-ac39-30b64181eb1e/mouse-move-2

 
-
   

Post Reply



 



Advertisement

Worth A Click