Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Isometric movement with wall collision question

BRGKeenBRGKeen Member Posts: 40
edited November -1 in Working with GS (Mac)
Hey all, I'm in need of some help on this one.

I have a game that uses an isometric viewing angle. Here is a link to a quick mockup picture so that you have an idea of what I'm talking about:

I need the player to be able to click anywhere on the screen, such as on that book shelf, and have the actor move to that bookshelf (even if it's just an image on the background and not an actor) without stopping when he touches the wall (I've been using friction to stop him, but I don't want him to stop I want him to keep going and stop under the touch.

I have the scene completely drawn and I add in a WALL actor to keep the character actor confined to the scene and where I want the player to be able to move him. I use a "MOVEMENT MAT" actor that is invisible so that when the player 'Touches' the screen the actor can move to that location.

What I need: I need it so that when the player touches the book shelf with their finger the actor will walk up, hit that wall, and then stop trying to move up the Y axis but just finish moving left on the X axis and stop right under where the touch was made, since the Y axis location is unreachable. This is just one example scenario since players should be allowed to touch anywhere and the character actor moves to the most ideal position as close to that touch as the scene allows.

Ultimate Goal: Player touches the scene and the actor moves to the most ideal position on the screen, closest to that touch location, that they are allowed to go and then stops when they reach it.

What I have already: Movement working without the interference of walls. I touch in any direction and the character actor moves and animates in that direction and stops. The problem is those annoying walls.

Hopefully that makes sense. I appreciate any help you can give.


  • DrGlickertDrGlickert Member Posts: 1,135
    It looks like the actors "head" is hitting the grey collide area. You could move up the collide object a bit so that the actor will "fit" into that space.
  • msonesmsones Member, Chef Emeritus Posts: 75
    Would you have a problem with the actor moving directly in a straight line to the object, rather then moving at an angle and then a straight line?

    If you don't have a problem with that, you can accomplish this with the "move to" behavior and some carefully chosen rule conditions.

    For instance - determine at which point the actor looks as though he has moved off the floor. In other words, if a user touches at the very top of the ceiling, you don't want your actor appearing to walk up the wall. Find that point, and use it strategically. Say, for instance, that it's 280 pixels. In your rule, include a condition ("touch.Y<280"). If touch.Y is > 280, then use the following alternative movement:

    Move to X (touch.X), and Y (280).

    The benefit of this system is you don't need any collide rules, or walls, or anything - the actor will simply move about the room normally. The room could actually be a background image, basically. On top of that, you could easily add a constraint rule that changes the height of the actor as it moves up and down the scene, so it appears to get taller as it moves to the bottom (closer), and shorter as it moves to the top (further away).

    Let me know if any of that is unclear.
  • Metronome49Metronome49 Member Posts: 297
    I don't know if this is a bad idea or not, but I have had success with this by making a smaller, invisible actor to represent the depth of the player's feet, and then constraining non-colliding player artwork to the feet. So you really are controlling the invisible feet depth actor, and the actor artwork follows it around. It would work for the backwall and any other collidable actors in the 3D space.

    I don't know if that would be bad practice for some reason, I just know I've experimented and it works. Works well for simulating z-index as well.
  • BRGKeenBRGKeen Member Posts: 40
    @DrGlickert: The problem is that I need a collision in order for him to stop or a rule that says he can't walk up there or past the point below the click. Something has to stop him if he collides with that wall so that he doesn't slide off the scene.

    @msones: I don't have a problem with that, except for an issue that may arise with my scenes being so diverse. What if a table were in the way of the actor? Ideally the actor (character) moves in a straight line toward the touch and can collide but "go around" the table.

    I need the actor to make its way to a point closest to that touch location while moving around obstacles like a table or another character (NPC).

    I think your solution would work, but I would have to adjust the X and Y for every contingency in every single scene and wouldn't account for hitting objects.

    @Metronome49: I've tried this but for some reason the constrain is overriding collision. How did you get around that? That solves the bulkiness of the character's collision, but leaves the issue of the character being able to still get to the final spot after colliding with a wall and stopping at that spot rather than continually sliding.
  • BRGKeenBRGKeen Member Posts: 40
    Basically I want to touch somewhere and have my character move to that position while navigating around boundaries (objects, walls, etc) that I have established. It may be a narrow walkway, a winding path, a bridge, or simply from one side of the room around a table to the other.

    It takes into account the same issue as I originally posted. The character hits the wall and isn't able to proceed on the X to the spot below the Y and stop because there's nothing telling the actor to do that. msone's idea works perfectly if the character was just in a box. I could set its boundaries and it works perfectly, but what if the path were not so cut and dry linear, etc.

    Maybe it's called pathfinding, I'm not sure.

    I hope that I'm making sense. Here's a video of Monkey Island doing something similar to what I want. Watch from 5:12 to 5:20 as the character navigates only the area of the game it's allowed to go, yet the player can click anywhere and the character will attempt to move to that spot.

    I have a feeling it's going to take dozens of attributes each scene. "If on this spot, restrict movement only to Y=200" and once hits this spot "X to 30" etc.

    How would I limit the range of movement to a range of X or range of Y?
  • BRGKeenBRGKeen Member Posts: 40
    Another reason that using walls is important is that when you press a location to move and press again quickly in another location, you can actually get the character to move out of the area you've restricted to move since 'move' attribute is not set to zero until you reach your location. So if I click a location and click again while my actor is moving there, move is set to 1 and he'll move to my mouse click even if it's out of the region that activates move.
  • Metronome49Metronome49 Member Posts: 297

    Oh, I didn't have to solve that problem. I'm controlling with keyboard. I'm sure there's a way to use my method and get that, though. I think my method of collision detection could really help you in a point-click adventure.
This discussion has been closed.