nimos100's Recent Forum Activity

  • Yeah you can do it with a loop. And just comparing what type of tile is influence and then based on that change them. There are no difference really whether its in a function or not. Except functions makes it easier to work with your project in general so a function whenever its possible

    Since you already know the starting point of which tiles to check meaning the impact tile X,Y and if you want the 8 tiles surrounding that you just have to start at that position (X,Y) - 1 so (X-1, Y-1). So you can do it like this:

    Since a tilemap will return -1 if there are no tile you can use that.

  • I think it will be easier for you to get help, if you add some explanation to your code. Tried downloading it and its pretty difficult to read and hard to know what problem you are referring to in the first place as Im not really sure what to look for. Maybe add some pictures to your post showing exactly what the problem is as I don't think a lot of people want to read code that have no explanation as it takes a long time.

  • Thanks nimos100,

    Is tile 12 a red one that replaces 9 tiles?

    Yes this example only use one tilemap.

    Without the Capx it im not 100% certain.

    But think the wait 3 seconds might be causing the problem as you destroy the bullet, but want to pass it to the function 3 seconds later, im not certain if that is working well or how it works, as i tend to avoid waits. But you have to remember that the rest of your program doesn't pause while this wait is going on. If i remember correct objects that are destroyed will be removed from the game at the next tick. Meaning that the bullet you are trying to pass to the function doesn't exist anymore when you actually need the tile position, and since you are waiting 3 seconds which is 180 ticks a lot of things can go on in the meantime. But anyway im not 100% certain, but regardless of that, i think such situations are best to be avoided because you lack overview of whats going on with waits in your programs.

    So i would use the bomb you create to spawn at the correct Tile (Where the bullet hit) and then add a timer behaviour to that and set it to 3 second, store the Tile position in the bomb or you can generate it later when the timer is up, then use the bomb tile position with the function. Meaning you pass the bomb coordinates to the function rather than the bullet. Think that will solve the problem.

    Otherwise try to add the capx.

  • Believe there is a plugin that might make you able to do this...(Not 100% sure though) might be for family related things.

    Otherwise you can add a variable to your object and instead of using UID you can just test vs this:

    Object.Name = <Something>

  • Think your problem is with the "Move" variable and the use of waits. My advice is to not use waits inside your code for something like this, because you can risk running into problems that are really difficult to debug, since its near impossible to figure out where in your code problems occur when you cant really track when thing triggers, you can run into some really annoying problems when you expand your games and they start to get more complicated. Personally I try to avoid any waits whenever possible, and only use them when a workaround for C2 requires it, or if the game actually need it for something, which is rarely the case.

    Anyway here is a modified version, which uses different speeds. I have added a Timer behaviour to the enemies instead of using waits, the benefit of that is that you can easy track where things go wrong as they trigger when the time is up. And the code inside them wont execute before that happens.

    CapX: https://dl.dropboxusercontent.com/u/109921357/Enemy_AI_help.capx

  • nimos100

    I am wondering how do we erase/change a range of tiles on a collision with a bullet. For instance, a bullet hits a tile, and then it should trigger a change of 8 tiles around the one that was hit. Let's say we erase those 9 tiles of tilemap 1 and replace them with tiles of tilemap 2 (the red one).

    I only managed to erase and set a tile that was hit , but no luck with erasing and setting neighboring tiles.

    Since you know which tile the hit takes place you can use this to change the surrounding tiles, simply by passing these coordinates to a function that will replace the correct tiles with the new ones, like this.

  • Sorry not quite what I was looking for, but I didnt explain myself very well. I mean could I go, say, +600 to Y axis and make it go there instantly, rather than a set coordinate with an X and Y value.

    Sorry not really sure what you mean? As Deathangel says you can just set the position and it will instantly go there as he have shown.

  • Depends how you want to make it.

    1. But you can either you is overlapping which will make you able to teleport the object as soon as they are overlapping each other.

    2. Use a distance check to see if the objects are within a certain range. Distance(Obj1.X, Obj1.Y, Obj2.X, Obj2_Y) will give you the distance between two object, you can then check if this is lower than a certain value and act on that.

    If you want to make it so it based on mouse you just switch one object with Mouse.X and Mouse.Y

  • Has anyone else noticed this / does anyone care / have any suggestions? My thoughts are that Chrome should be capable of simply demanding more CPU access when running a demanding game, so games like mine can run all of their data processing unimpeded. Perhaps a game maker could raise a flag to permit this to happen. Am I being naive - is Chrome's access to processor time controlled by Windows or can it demand more if it needs it.

    You have to be very careful how you test you game when it comes to CPU and FPS and what conclusions you draw from them.

    Using the debugger to validate CPU and FPS are extremely unreliable and depending on how you measure it you get different results, that you cant really use to a lot I think.

    Here is an example:

    All tests are made from the same place in the game.

    1. The first image shows the stats that I get using the Debugger in NW.js when the system tab is selected.

    2. Second image show how much this information changes simply by changing tab from system to a another tab.

    3. Is without debugger tracking the data in game and fits well with the second test when using debugger.

    So when testing performance you have to take into account which tab you have selected in the debugger. And at least in my opinion, doing any testing in the system tab is completely useless, because you cant use of any of the data you get there to anything, it doesn't reflect your game performance, but the game and the debugger performance combined.

  • An easy way to do it is to make an invisible "tracker" sprite so when your enemy have chosen a location to go to. You use the tracker to see if the location is free. Can do that by doing a "Tracker is overlapping enemy" and if that is true you make your newly created enemy find a new location etc.

    Or you can use the tracker to find a valid location and when it does you throw that to the newly created enemy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It should work at least I don't experience problems with it

  • Or you can add additional keys to your code without having to change anything. Just add "On key press" separately of the ones you are already using as these will only trigger once automatically.

nimos100's avatar

nimos100

Member since 23 Sep, 2012

None one is following nimos100 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies