i use :
every tick -> set playerposition to mouse X & Y
i have 4 walls . when i move the mouse over the (solid! ) walls the player goes through them like butter.
how to prevent this ?
what would you want to happen when the mouse is over the wall?
would using drag and drop and automatically dropping if mouse is over wall be a solution?
no the player sprite should just NOT go through a wall even if the player sprite position is under the cursor
Develop games in your browser. Powerful, performant & highly capable.
Sure, what should the sprite do when the cursor is on the other side of the wall?
I assume adding the condition mouse cursor is not over wall is not enough..
Have you a HTML5 demo or a demo capx file? Normally it should be enough to set the walls solid and add the platform behavior to the player.
It would be a lot easier to answer your question if it would be clearer what you are trying to achieve..
if you want to restrict the player to a certain area, using clamp would probably help..
Okay im uploading a windows32bit build now.
in the meantime i will try to describe what i want to do.
You have a room where enemies are bouncing around against walls.
your player is UNDER your cursor and you have to avoid the enemies.
BUT you can cheat if you just place your cursor with the player in a corner so deep that the enemies wont hit you.
heres the download : https://www.mediafire.com/?4jep22x6dda55k4
using clamp would work
player set x to clamp(10,400,mouse.x)
player set y to clamp(10,800,mouse.y)
I had to guess the numbers, but the 10 should be the width of the walls, the 400 should be the projectwidth-the width of the walls
800 = projectheight-width of the wall..
wont this be a problem on a mobile device wehn the fullscreen is scaled with letterbox scale or so?
using clamp causes i have to keep pressing the mouse button to enable it .
There's no reason why using clamp would act differently than not using clamp..
it's just limiting the max and min x and max and min y-values..
typed too fast
had the order wrong within the clamp expression..