Magistross's Forum Posts

  • Do it all in one go, not in multiple pass / loop.

    Add a "priority" number instance variable to your cell family and do something like :

    For each cell order by cell.priority

    Then according to the type of cell, do the correct calculation. This way you'd loop over your cell collection only once.

  • It should be cake walk to do that kind of calculations for any CPU at all.

    Care to share a bit more of your event sheet ?

  • abs(Ghost.X - Player.X) + abs(Ghost.Y - Player.Y)

    This expression is the Euclidean distance between the player and the ghost, and 96 is the size of 3 tiles. So the "fake" obstacle is added only when this distance is less than 3 tiles long.

  • Well, the thing is, this is a behavior and not a plugin per say, so it needs to go in the behaviors directory.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did some tweaking in your file, like changing the calculation to synchronous and forcing calculation immediately after pathfinding calls.

    I also hacked in a mechanism that will make the ghost unable to reverse direction unless the euclidean distance is lesser or equal than 3 tiles. It's not perfect, but at least the ghost won't be changing direction as much. :)

    dropbox.com/s/gdicr9qc3hc4uce/Pacman%20test.capx

  • I once made an example for something similar using EasyStarJS.

    You will need to download the latest version (1.04) of the plugin to open the capx.

  • Not out of the box, but the template is rather easy to expand and adapt.

    For your particular need, I would create a new function based on the "choice" one that creates the new smaller window as you said.

  • Instead of creating and destroying objects as they come and go, alter their visiblity and positions. It's far less taxing I believe, although in the end it depends on how many objects you actually need.

  • Have you tried objects recycling ?

  • Construct 3 added the "Create object (by name)" action that could be useful for that.

  • Create a function that set groups initial states. Whenever you need to reset your groups states, call that function.

  • I guess the most straightforward way would be to create your own "find" method.

    Like this :

    https://i.imgur.com/rmrSKZm.png

  • You could use helper functions that makes it explicit what each condition does.

    IsTileWater(x,y)

    IsTileMountain(x,y)

    etc

    You could then also create another function that re-use those.

    IsTileObstacle(x,y)

    This function could then allow you to alter the way your sprite can move. Like this. Please forgive my awesome artistic talent. :)

  • You are right. The hard part will be the actual character set / spritefont setup.

    It might be easier on the engine if you use multiple spritefonts, one for each non-latin language you need. However, it would require a bit of rewrite of the engine to use a spritefont family. You'd also need to move both instance variables of the spritefont to the family itself and make the proper changes to the events.

    Nice looking game by the way. Looks pretty professionnal, and really polished!

  • Well, this is a simple operation. If you want to figure which direction a sprite should be from one position to another, you just need to compare the coordinates.

    Position2.X > Position1.X => Right

    Position2.X < Position1.X => Left

    Position2.Y < Position1.Y => Up

    Position2.Y > Position1.Y => Down

    And a combination of those for diagonals if you allow them.