Be a Supporter!

Preventing mouse avoider cheats.

  • 715 Views
  • 13 Replies
New Topic Respond to this Topic
masterlink950
masterlink950
  • Member since: Jan. 4, 2007
  • Offline.
Forum Stats
Member
Level 06
Programmer
Preventing mouse avoider cheats. 2008-10-11 23:22:02 Reply

Hey I am working on a mouse avoider game and I have seen its possible to skip over walls if you move to quickly. I was wondering of a way to fix that other then making all the walls huge.

Magical-Zorse
Magical-Zorse
  • Member since: May. 10, 2008
  • Offline.
Forum Stats
Supporter
Level 39
Melancholy
Response to Preventing mouse avoider cheats. 2008-10-11 23:27:47 Reply

on (mouseDown) {
	nextFrame();
}

I think that'll work
as for the right click thing, I'm not sure how to fix it.


BBS Signature
masterlink950
masterlink950
  • Member since: Jan. 4, 2007
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Preventing mouse avoider cheats. 2008-10-11 23:30:00 Reply

At 10/11/08 11:27 PM, Magical-Zorse wrote: on (mouseDown) {
nextFrame();
}

I think that'll work
as for the right click thing, I'm not sure how to fix it.

I have already fixed the right click issue. But as far as what you just showed me I dont think that will deal with people moving there mouse too quickly, I think that would move to the next frame if the left mouse button is pushed down.

ActionSick
ActionSick
  • Member since: Apr. 26, 2008
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-11 23:36:22 Reply

perhaps make a speed variable for the mouse:

mxspeed += _root._xmouse;
myspeed += _root._ymouse;

if(mxspeed >= 100){
you lose...

something like that possibly

masterlink950
masterlink950
  • Member since: Jan. 4, 2007
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Preventing mouse avoider cheats. 2008-10-11 23:39:52 Reply

At 10/11/08 11:36 PM, ActionSick wrote: perhaps make a speed variable for the mouse:

mxspeed += _root._xmouse;
myspeed += _root._ymouse;

if(mxspeed >= 100){
you lose...

something like that possibly

That would be possible but it would be extrodinarily annoying for anyone playing.
And I would have to find out the speed you need to be moving to glitch through walls :\
(actually I don't think its all that fast either.)

ActionSick
ActionSick
  • Member since: Apr. 26, 2008
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-11 23:45:42 Reply

if your walls are fairly thick, this shouldnt happen at all, try putting your FPS higher, 30 is a decent speed.

and show me your hittest you are using

masterlink950
masterlink950
  • Member since: Jan. 4, 2007
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Preventing mouse avoider cheats. 2008-10-11 23:47:24 Reply

if (_root.walls.hitTest(_x, _y, true))

Of course theres some other script with that but thats the basic hittest

ActionSick
ActionSick
  • Member since: Apr. 26, 2008
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-11 23:48:10 Reply

are you using a custom cursor?

Musician
Musician
  • Member since: May. 19, 2005
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-11 23:54:41 Reply

Just increase the frame rate of your movie. The "cheat" you're talking about is a phenomena known as tunneling, and it can only be properly fixed by partitioning the space between where the mouse was in the last frame and where it is now into small intervals, and then checking each interval for a collision. But doing something like that takes an extensive knowledge of both Actionscript and Mathematics, so the next best solution is just increasing the frame rate of your movie so that it checks for collisions more often.


I have no country to fight for; my country is the earth; I am a citizen of the world
-- Eugene Debs

masterlink950
masterlink950
  • Member since: Jan. 4, 2007
  • Offline.
Forum Stats
Member
Level 06
Programmer
Response to Preventing mouse avoider cheats. 2008-10-11 23:58:25 Reply

Sorry supposedly i hit my quota of posts for this topic,

And like I was going to say: I am using a custom mouse but I was using the hittest for the normal mouse.

And to musician: My fps is at 60....

mayoarm11
mayoarm11
  • Member since: Jun. 13, 2007
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-12 08:41:28 Reply

At 10/11/08 11:58 PM, masterlink950 wrote: And to musician: My fps is at 60....

that's dumb.

this problem is easily solved by making your walls thicker.

or trying musician's solution. calculate the angle between the previous position and the current position of the mouse (using math.atan2), run a for from the prev pos to the current one using cos and sin of the angle as ur x and y values. check if the wall hits those x and y values, and if so, the user has 'cheated'.


Awesome turret game in the making, featuring 85 uniqe turrets: News post

BBS Signature
Guil07
Guil07
  • Member since: Oct. 13, 2007
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-12 11:44:00 Reply

This is stupidly simple.
Most people make their custom cursor with

onEnterFrame = function() {
mycursor._x = _xmouse;
mycursor._y = _ymouse;
}

However, this updates the mouse every frame, and depending on your frame rate, this may appear jumpy and may allow the player to skip from one side of your maze to the other in one frame..

This should fix it:

onMouseMove = function() {
mycursor._x = _xmouse;
mycursor._y = _ymouse;
updateAfterEvent();
}

the updateAfterEvent forces the code to run every time the cursor is moved, no matter the fps.
So even if you're running at (eg) 2 fps, everything will look jumpy, but the cursor will move perfectly.

This should stop the cursor from skipping over walls when the mouse is moved quickly.

Also, to avoid left and/or clicking:

in an onEnterFrame = function() {

anywhere, put

if (Key.isDown(1)) {
gotoAndPlay(XX);
}

And send the playhead to a "don't cheat" frame or scene, or reset the maze, up to you.

if (Key.isDown(2)) {
}

is for right-clicking. to track both left and right click in one if statement try

if (Key.isDown(1) || (Key.isDown(2)) {
<run this code..>
}

the "||" acts as "OR"..

Hope I helped.

~Guil


BBS Signature
henke37
henke37
  • Member since: Sep. 10, 2004
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-16 04:07:01 Reply

The best way is not to calculate the mouse speed or trick with making sure that there is more events fired. No, the best way is to do a line intersection test between the last mouse location and the new location, if the line intersects the obstacles, the cursor more than likely hit the obstacles.


Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.

sunnyboy567
sunnyboy567
  • Member since: Dec. 15, 2007
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
Response to Preventing mouse avoider cheats. 2008-10-16 05:59:35 Reply

hey here is a awsome avoid thingy u can use this program to avoid stuff with mouse it a cool program so it don't make me cheat mouse avoider


SunnyBoy567

BBS Signature