Nabu's Recent Forum Activity

  • Problem Description

    Sprite with pathfinder won't find path in Chrome and NW.js if some musics are played

    Attach a Capx

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

    Description of Capx

    Layout with a Tilemap. Spawn player with right click, make it find path with left click.

    Steps to Reproduce Bug

    • Step 1 : Make a layout with tilemap, and another layout with player sprite. Make a spawn function to create player at mouse coordinates. Make a music plays at first layout start. (not all music make the bug appears, only the first one in the given .capx)
    • Step 2 : Spawn player (right click). Left click to make the it find a path, at a location hidden with obstacle. Observed Result Sprite with Pathfinding behavior won't find path if there's an obstacle between his position and destination. Else it works. If the player sprite is already in the first layout nd not spawned via a function, and the path obstacle is added at ayout start, problem won't appear. Expected Result Sprite find path. Affected Browsers
      • Chrome: (YES)
      • NW.js: (YES)
      • FireFox: (NO)
      • Internet Explorer: (NO)

    Operating System and Service Pack

    Windows 7 SP1

    Construct 2 Version ID

    Release 200 64bit

  • I did some tests, trying to reproduce the problem but failed. The only thing I discovered is it works under Firefox, but no under Chrome or NodeWebkit. I would like to make a desktop game, so export to NW.js...

    The special things in my project are :

    • two tilemaps (only one is given as obstacle to pathfinder)
    • tilemaps randomly generated (obstacle given to pathfinder after map is generated)

    Don't know if it's the cause.

    Any idea ?

  • Hey,

    I've never done that but just thought about it. You can retrieve the waypoints from a given path and use the physics to reach them. Once unit arrive (don't know if there's an ever built in condition, or just compare unit position and path's current node) go to the next. The physic movement implementation should be the difficult part, because you will have to tweak forces (in construct itself or from a movement plugin) for you unit move nicely towards a direction to a given point.

  • Hello,

    I'm having issues with the Pathfinding behavior. First I'm sorry to have nothing to show because I can't reproduce the problem in a small simple project and mine is way too large for asking other people to work on it or find a mistake in it.

    The problem I have is that sprites with Pathfinding behavior achieve to find path if the path is a straight line, but not if it needs to avoid obstacles. I have already verified the map (tilemap) and checked the pathfinding obstacle map and everything is ok. The sprites are stuck in "calculating" path. The behavior is set to custom and I add the tilemap at sprite creation, after tilemap is created. Changing to solid do not solve the problem.

    I tested everything and tried to reproduce the error without success. I'm lost.

    Anyone has ever encounter the same ?

  • Ok, thank yo all for the tip. Grateful

  • Hello,

    The problem you have is probably related to SCOPE, object picking and object creation. The functions have a scope, itself, and almost everything outside is ignored. So when you call the "spawn_ship" function, it works as expected. But when you call after that the function "set_FactionRed", the latest created SHIP_small instance is out of scope. Also, when you create an object, you can just set up its variables in the first following event scope. When you press F a second time, your function "set_FactionRed" will get al last the first instance of the SHIP_small object type, due to the fact that objects are accessible the next tick they are created (except modifying them just in the same event scope after system => create object). That's why operations in the "spawn_ship" function works correctly but not operations from the "set_FactionRed" function.

    I hope it's not confusing...

    So what you can do is putting everything in the first function (quick but not very practice), or put the "returnValue" property of your functions with the UID of the nely created object (Object.UID, not ID as it's not reliable) pass it (Function.ReturnValue) to the functions that are following. In these functions, you have to pick the instance by UID first (so in a function, it's with Function.Param(something)) and do the modifications you want.

    Not confusing ?

    I'm not very good in english for explanations...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey, here's a little example with spikes that goes underground endlessly. I set up three types of spikes, just changing the "wave" property of the Sine behavior. Note that the "sawtooth" wave equation is probably what you want. Just check the collision with the sprite and players/entities and do as you like. You can add randomized values to the Sine behavior if you want it to be less predictable. The "width/height" parameters of the "movement" property could be good too as it scales the objects. The magnitude is how large is the movement, in pixels or percents.

    You can see that the spikes are on the "behind" layer, with "tilemap" layer in front.

    This is a simple way to do that. You can also have custom movement by writing your own and changing state and position of the spike object every tick or less. For example you can add a "active" bolean variable to the sprite and set it true only while it's rising from the ground, setting false while retracting. When you're checking for collisions you can also check for if the spike is active or not. If it is, hurt the player, if not, the player can walk upon it.

    Hope this helps if you haven't already find a solution.

    https://www.dropbox.com/s/9xusp6gx0y00e0u/spikes.capx?dl=0

    Cheers

    Nabu

  • Hey,

    Just wanted to know if there's a way to display the pathfinding obstacle map. It would be useful when debugging a project.

    Thx

  • I managed to correctly draw the Tilemap with your tip R0J0hound. It works pretty well and allows the rest of a game development. The probleme is mainly with Particles and Spritefonts that are a little bit harder to move, paste and move back. That's why I wanted to simply move the viewport, but it doesn't work well.

    What's exactly the problem with the project I attached ? Why the viewport get stuck in the last moved position ?

  • Hi,

    I have a problem with the function "Scroll To Position". I'm trying to set up a split screen game with the Paster plugin. The fact is that some object (tilemaps, particles, spritefonts) are not displayed if not on screen. So I have to move these objects every tick to the player position to paste them on the canvas and move them back to their position. As an alternative I tried to just move the viewport to player position, to make everything near him onscreen. But this didn't work as expected.

    So every tick I scroll the viewport to the player position. If there's one player, it works well. But with two players and two canvas I have to scroll the viewport twice in the same tick. The view port seems to be stuck in the last scroll position as the special objects that require to be on screen are not displayed if player 2 if too far from player 1.

    I made a little project for example. You can seen that the tilemap is not always paste onto the first screen (player1) unless player 2 is close to player 1.

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

    So is it possible to scroll twice in the same tick ? Or is there something to do to achieve this ? Cause I find moving all objects to fixed viewport and moving them back sometimes hard to implement with big project and moving the viewport would be more simple.

  • Thanks for your help Coin Coin ! , but I think this won't work with the Tilemap, as the tiles are one whole object and I can't hide some tiles while other are visible.

    Actually I can have the desired effect (hidden walls) if the walls of the TIlemap are black and the shadow is black too. Thus everything that is in the shadow merge together.

    Anything else ?

  • Hello,

    If I have a Shadow Light object and some walls (tilemap) with Shadow Caster behavior on top of layer (as I want to display it and not being shadowed) , is it possible to display only the walls that are close to the light source and not all of them ? If a wall is separated from the source by another wall, I'd like to not display it.

    Anyone has found a solution or it is impossible with the implementation of Shadow Light object ?

    Edit : here's a modified image from a previous post that talks a bit about what I want.

    This in construct 2 :

    https://www.dropbox.com/s/6vsoblo56a2qzz4/shadow1.png?dl=0

    What I would like to have :

    https://www.dropbox.com/s/ixr9t3lcc3vx81f/shadow2.png?dl=0

Nabu's avatar

Nabu

Member since 14 Feb, 2015

Twitter
Nabu has 1 followers

Connect with Nabu

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

14/44
How to earn trophies