Simple Maze with Collision Detection (navigated with mouse cursor)

  • #1, by afrlmeSunday, 28. October 2012, 21:48 12 years ago
    Well this should technically work but for some reason V.S doesn't like it when I use complicated object area shapes! (this one is 100x simpler than maze I started with & this one doesn't work properly either - but at least you can see LUA setCursorPos in action)

    if you look closely at the object area I assigned to the maze you will see that it should allow you to move freely within any of the white area. touching the black lines (outside object area will play a buzzer sound) - think operation! razz

    For some reason mind, it is not working correctly and randomly decides when you have moved outside of the object area regardless of whether you have or not & will thus play the buzzer sound & reset your cursor back to the start point using LUA Script ...

    
    setCursorPos({x=co-ordinate,y=co-ordinate})
    

    you can find the correct co-ordinates by hovering the mouse cursor over a scene & looking at the (x,y) section on the top right hand side of the scene editor. - check screenshot below.

    http://alternatingfrequencies.com/vs/sm_screenie.png

    I've tried deleting & creating a new object/scene & even project file & it doesn't matter as it still does the random cursor out bug.

    Anyway you could use setCursorPos for when you open up your inventory or maybe if you have a dialog box open & don't want the cursor to be able to leave the dialog box or maybe you need the cursor to stay in a certain area for some reason.

    Link: http://alternatingfrequencies.com/vs/simple_maze.rar (2.56mb approx)

    P.S: if anyone has any clue what's wrong with this, then please let me know!

    Cheers wink

    Imperator

    7278 Posts


  • #2, by FlorianMonday, 29. October 2012, 01:45 12 years ago
    That just reminded me of a similar project, I had to abandon in 2010, when I realized, that Visionaire can not handle the object areas properly. I made my track much narrower, that AFRLme did, but Visionaire makes it impossible to walk that path now, even if there in fact is enough space. You can only solve the first tight encounter, if you illegitimately cut the curve, using an exploit.

    Maybe it becomes clearer, if you look at my unfinished example. I only draw an object area up to the second cave in this first map. Likely you will never reach that spot, according to the error, AFRLme and I have encountered.

    pixeldorado.kilu.de/pathfinder/cave.zip

    the full directory reads: pixeldorado.kilu.de/pathfinder/ (sorry for the annoying layer ads on this free webspace)

    Newbie

    26 Posts

  • #3, by afrlmeMonday, 29. October 2012, 02:08 12 years ago
    downloading & checking smile

    I find the bug to be strange as it makes no sense at all ...

    If I were to map out the area with a way system & points & have a character walk around it - it would probably work fine.

    the original maze I was going to use had 2 different paths which lead up to the top exit & the lines were even closer together but I decided after spending ages drawing round that one for it to not work I'd try a really simple maze with more moving space & still ended up with same buggy results roll

    plus the log file does not report any errors but bleh - sod it!

    cheers for your example smile

    Imperator

    7278 Posts

  • #4, by FlorianMonday, 29. October 2012, 10:48 12 years ago
    I wonder if it will become suitable, to create the maze as a person.

    Unlike an object, the person needs no drawn object areas, but shares the same mouse in/ mouse out mechanics, if I remember correctly. It may appear weird to insert a person as a valid area, but that might be a workaround. Of course, only if you don't bother to treat people like objects.

    Newbie

    26 Posts

  • #5, by afrlmeMonday, 29. October 2012, 12:29 12 years ago
    if you use it as a way system? you can add action areas in the way system too which you can define cursor enter/leave statements - I believe it's possible to make the character be at cursorPos with LUA - not tried it mind.

    Imperator

    7278 Posts

  • #6, by FlorianMonday, 29. October 2012, 15:18 12 years ago
    Let me reach back a little: The idea behind those collision games is basically that the mousepointer follows a predefined path to its destination. For an instant and direct control, we can not use the custom protagonist to follow our mouse clicks, as we are used to from common point-andclick-adventures. The mouse pointer itself has to become the protagonist. (Annoying side effect: The collision square of our mouse pointer character still reads 1x1 pixel, even if the character image itself is larger.)

    The next step is to tell the engine, what area is valid (=walkable) for our mouse char. However, we can not use the walk area tools, we know from creating the backgrounds, as we do not have a moving person, in the original sense. Therefore we used an object layer as maze and defined the object bounds as walk areas. This, why the f&#k!?, did not work properly.

    At this point, I had the idea, to bypass the object border problem, by using a different layer for the maze, where object boders are not required. -> The Path is definded as Person. To draw the walkable area and define the image as a person, haven't I tested so far, but a person in Visionaire is clickable object, with mouse in / mouse out mechanics and the person's bounds are solely definded by the transparent parts of our image, right? Which additionally saves a lot of time, by not having to draw the object boxes.

    As I mentioned I have not checked this option, but that could be a work around, to bypass the engine's collision bug, caused by the object boxes.

    Greetings,

    LUA-Refusnik Florian

    Newbie

    26 Posts

  • #7, by afrlmeMonday, 29. October 2012, 15:32 12 years ago
    yeah I think you're more or less getting at what I was trying to say smile

    I know you can control character pos by the cursor pos - so with a loop to check the char is in/out of the way area / action area then it will know whether to reset cursor/char pos or allow you to keep on going.

    I'm not planning on using this in a game - I was simply trying to demonstrate a collision detection thing which is triggered by the mouse cursor much like the operation game where you have to remove organs without touching the edges.

    & it was also meant to be an example for setCursosPos LUA Script.

    But sod it razz

    Maybe V.S team will address the object area bug in a later version!? It is a rather daft bug after all!

    Safe smile

    Imperator

    7278 Posts

  • #8, by unrealSaturday, 16. August 2014, 02:35 10 years ago
    Argh, another script unavailable to download confuse

    Is it possible to get it back please ? It would be cool.

    Newbie

    66 Posts

  • #9, by afrlmeSaturday, 16. August 2014, 05:48 10 years ago
    It didn't work properly. VS didn't seem to like complicated way borders, object polygons or action areas.

    Imperator

    7278 Posts