Badmiracle's Forum Posts

  • Hey guys,

    The NPCs in my game will attempt to Pathfind around a solid object, but if the Solid object rotates too quickly it sometimes collides with the NPCs. How would I make the NPCs react to this collision by being pushed back - and then shortly after have them resume their pathfinding.

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make sure your Pathfinding Cell border is High (maybe even equal to average Line of Sight?) This way Herbivores will stay readily away from Carnivores naturally as quickly as 1 second once they come into Line of Sight. Carnivores will not mark Herbivores or other Carnivores as Obstacles - therefore they can Path Find right to them.

    Add Sprite Y as an Obstacle for Sprite X (Generally - Animals should always have other animals they wish to avoid as Obstacles in their Pathfinding)

    Be sure to Regenerate the regions of the Pathfinding Grid as objects move (otherwise the Solid objects on the map won't update) - you'll probably want to do this in the most efficient way possible - try taking into account your Sprites Line of Sight and generating a Rectangle that size around your object. Use "Regenerate Region" and do..

    Start X: SpriteX.X - (SpriteX.LineOfSight.Range / 2)

    Start Y: SpriteX.Y - (SpriteX.LineOfSight.Range / 2)

    End X: SpriteX.X - (SpriteX.LineOfSight.Range / 2)

    End Y: SpriteX.Y - (SpriteX.LineOfSight.Range / 2)

    Finally, Every 1 Second & Has Sight of THREAT > Find Path away from Threat

    You may want to make the Pathfinding Cell Size/Border smaller for smoother movement on different animals.. but this will likely require more memory usage as a new Pathfinding grid would have to be generated for each unique size.

  • You can use "Object is overlapping" to detect for collision. Also make sure that your sprites have a proper collision polygon set.

  • Asmodean - good attempt I like what you were thinking but unfortunately this locks the players Angle to the Angle of the Train.

    Does this solve your problem?

    https://dl.dropboxusercontent.com/u/485 ... oved1.capx

    LittleStain thank you! You've solved a huge problem for me. I initially had a similar idea to use the Train objects OldX and OldY but I couldn't for the life of me figure out how to work out the changing of the angles. Thanks again!

  • Bump

  • Sure, sorry about that. Here is an updated link (but they both should work - that was odd).

    Thanks in advance if you can figure it out!

    https://www.dropbox.com/s/hxbw3paavdkpr ... .capx?dl=0

  • Although that would contain the player from being moved out of the train, that still wouldn't work because the player would constantly be being pushed to an end of the train depending on its direction.

  • Need.. help... from.... those of superior intellect

  • Check out this tutorial to see how Line of Sight was done by stretching a sprite and checking for overlap.

    https://www.scirra.com/tutorials/474/pa ... e-of-sight

  • Hey,

    I am trying to make a train game, where the player can board a moving train. Right now the train is simply moving along a path continuously.

    I want the player to be able to move around freely when on the train cart and as the train moves and changes directions, the player should move with it.

    I tried to set the X and Y coordinates of the player to match that of the train, but of course this would mean the player is locked onto the train (and not able to move freely around the moving train cart the way that I want).

    Does anyone have any ideas how this could be done?

    Thanks in advance.

    Dropbox (CAPX): https://www.dropbox.com/s/hxbw3paavdkpr ... .capx?dl=0

    One Drive (CAPX): https://onedrive.live.com/redir?resid=7 ... ile%2ccapx

    Best,

    Adrian

  • Hey Black Rabbit,

    It could be a number of things - feel free to share your capx file so that we could be of more service.

  • Doe's anyone know how far the construct 2 editor can be pushed?

    By this I mean could I create a truly massive game with hundreds of levels and characters?

    You could stress test the engine yourself by using a loop that creates and/or destroys objects repeatedly. Depending on how far you get - you'll notice your machine (not the engine) as the main hindrance.

  • Well it seems like if I want to "Simulate Moving Up" in an action then I need to set an object, the object being the FamilyHeroes object.. how would I use the Self function instead?

  • Hey!

    I am currently working on a game where I have a "Heroes" family object set up, and I want the Player to be able to control multiple Heroes independently of each other.

    The move order is in a function called "MoveUp" - which currently gets the Heroes family to simulate pressing Up for a period of time. The issue is when one Hero is selected and given a move order - the other Heroes on the map move as well.

    Is there a way to just move the selected hero?

    Thanks in advance.

    Best,

    Badmiracle

  • Hello world.