Set custom solids?

0 favourites
  • 7 posts
From the Asset Store
A whole set you need to create a gorgeous winter 2d game
  • I'm having a bit of trouble with enemy movement in my game. I have a main tilemap which should be completely un-traversable for all enemies, so I've been using the "Push out solid" action when they overlap with it. The problem is some enemies have a "flying" attribute, which enables them to move over other solids (like furniture in the rooms) normally, but when they collide with the tilemap, the push out solid action pushes them out of the furniture as well as the tilemap.

    I've tried using custom movement to mock up my own "push out solid" behaviour, but it's hard to get it working with the tilemap, since there's no easy way to push something in the opposite direction of the point of collision (pushing it in the opposite direction of the tilemap itself won't work).

    Is there any way to make certain objects only treat certain others as solids? Ideally flying enemies should be seeing the furniture as non-solid, but the tilemap as solid.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Not sure if this is what you mean, but here is a simple example of how you could do it.

    Obviously the blue is a flying unit

  • Thanks for the reply! I don't think that would work though, unless I've misunderstood it. The problem's that "Push out solid" simply triggers for every solid the object is touching, not just the solid being referenced in the event.

    Basically, flying monsters can move over furniture (sprite, solid) fine, as I don't have any collision events set up for them & the furniture. But when a piece of furniture is close to a wall (tilemap, solid) and the flying monster collides with the wall while also over a piece of furniture, it suddenly pushes them out of both, which looks a bit jerky and rubbish.

    One possibility is just to remove all solids from the game and do all of the push out stuff manually with custom movement... but that'd take quite a lot of work with the project in its current state, and if I'd like to see if there's an alternative using the native push out first. I might just be misunderstanding your example though, if I have could you explain a bit more please?

  • I dont think you have misunderstood my example. I was just making a guess to what you were trying to do. Don't you use custom movement now or what?

  • My player uses 8 direction, while the enemies mostly use a combination of MoveTo and custom movement. I have custom movement to "bounce" the enemies off one another when they're clustered together, and that works fine. I can't use the same thing with the tilemap though, because I have to set a direction for the bounce - usually I use angle (SolidObject.X, SolidObject.Y, Enemy.X, Enemy.Y), which won't work with the tilemap since its X and Y are at 0,0 (or some fixed coordinate anyway). If I could somehow return the coordinates of the point of collision with the tilemap, that might work, but I'm not sure how.

    To be honest, movement and AI's always one of my biggest headaches I don't like using push out solid at all if I can help it - it tends to lead to janky, glitchy movement - but it's the only way I can see that'll make sure the enemies don't go clipping into the tilemap.

  • But if you put a solid on a tilemap, its only the tiles which have a "graphic" that does the collision. The rest of the tilemap will not collide with your objects as I showed in my example, so the X,Y is not necessarily or most likely never at 0,0, unless you ofc put a tile in that position. But don't think I really understand what you are trying to achieve

  • Ha no worries, it's a pretty specific problem and I'm not explaining it all that well. I think it's a limitation with how solids are treated by behaviours - basically you can't have "push out solid" for one specific group of solids only, which is what I want. Had a bit of a brainwave last night though and I think I've figured a way around it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)