Fire Dragon Posted February 3, 2006 Share Posted February 3, 2006 I make now mouse based game,and I need somekind "mouse barrier".So question is,how make image,that prevents you to move mouse over it?Example,if I create square with these image objects, you can't move mouse cursor inside square.Is thiskind code possible?Thanks for help. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 3, 2006 Share Posted February 3, 2006 it is not possible to prevent the mouse from going over an area but you can prevent events from happening while over an area. Link to comment Share on other sites More sharing options...
Fire Dragon Posted February 3, 2006 Author Share Posted February 3, 2006 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 More sharing options...
aspnetguy Posted February 3, 2006 Share Posted February 3, 2006 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. Link to comment Share on other sites More sharing options...
Fire Dragon Posted February 3, 2006 Author Share Posted February 3, 2006 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.<{POST_SNAPBACK}> 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 More sharing options...
aspnetguy Posted February 3, 2006 Share Posted February 3, 2006 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 More sharing options...
Fire Dragon Posted February 3, 2006 Author Share Posted February 3, 2006 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 More sharing options...
aspnetguy Posted February 3, 2006 Share Posted February 3, 2006 <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 More sharing options...
Fire Dragon Posted February 3, 2006 Author Share Posted February 3, 2006 OK.Something what I thought.I should try it... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now