Jump to content

"Mouse barrier"


Fire Dragon
 Share

Recommended Posts

Hmm,how?I planned for my mouse game stirs image,and when you move cursor over it,it transter you to new level.This I can make easily with mouseover,but I want make around stairs wall,and you must destroy wall pressing switch.After that walls disappear(with ID code)and now,when you move mouse over stairs,it moves to next level.If I understand your post right,something like this is possible?

Link to comment
Share on other sites

oh i misunderstood I thought you didn't want to let the mouse go over the stairs...you can tie a onmouseover event tothe stairs image that will trigger the function to move you to the next level.

Yes,that is part,what I figured myself,but how I can prevent events over stairs,and then,when player presses switch,prevent disappears,and onmouseover code works with stairs?
Link to comment
Share on other sites

When a player gets tot he stairs do a check to see if the switch has been pulled...Start the level with var switchPulled = false then when they get to the switch change the value to true...only allow the stair function to execute if wsitchPulled = true;

Link to comment
Share on other sites

Ah,I think variable using too.So I make only code like this in stairs:

<script type="text/javascript">var switch =falsefunction stairs()if(switch==true){window.location"http://www.w3schools.com"}</script>

And this kind in switch:

<script type="text/javascript">var switch ==true</script>

Is this code workable?I'm not be so sure about switch's code,what must turn var to true...

Link to comment
Share on other sites

<html><head><script>var switchPulled = false;function stairs(){   if(switchPulled)   {       ...code to go to next level...    }    else    {       alert('you kmust pull the switchbefor continuing');    }}function switchPull(){    switchPulled = true;}</script></head><body>...<img src="stairs.gif" id="stairs" onmouseover="stairs()" alt=""/><img src="switch.gif" id="switch" onmouseover="switchPull()" alt=""/>...</body></html>

Something like that

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...