brunopalermo's Recent Forum Activity

  • AJAX on complete - call function CreateLevel; wait 0; call function CreateEnemies;

    This is exactly my workaround. Even though I'm not using the wait, since it's not necessary.

    What I'm trying to figure out here is WHY should I need two functions when one should work perfectly well. :) In fact, if you check the log in the Browser console you'll notice that I can reference tiles normaly before, but, for some reason, when I'm creating enemies they seem to disapear, even though they are still there.

    Seems like a bug to me. If the problem were the order of creation, the Browser logs wouldn't work either but they do...

    Thanks anyway.

  • Here's an old example I had around with a progress bar. Just click anywhere to increase it for a random amount.

    Cheers!

  • It should be working. It's hard to guess the problem without seeing actual code or a file. But, "if", "while", etc should work.

    Also, depending on the event, like, for instance, if it's something that you need players to see every step (like an energy bar incresing), you should use a timed loop (every X seconds) or a timer event, and add the condition to stop it at the beginning.

    Hope this helps...

    Cheers.

  • So, no developments on this.

    I tried crating another function to create enemies and call it at the end of the function that builds the level. It still can't reference floor tiles. Any other thoughts?

    Cheers!

  • I don't know about array size limits, but is it really necessary to have rooms in the array since most of the cells would be empty? Why not having an enemy array, which would be 2D, with X for enemies and Y for attributes, and checking only the enemies which are in the loaded room?

    For instance, the array would look like this:

    enemyArray = 
    --[
    ----[roomId, enemyX, enemyY, enemyLife, enemyState],
    ----[roomId, enemyX, enemyY, enemyLife, enemyState],
    ----[roomId, enemyX, enemyY, enemyLife, enemyState],
    ----[roomId, enemyX, enemyY, enemyLife, enemyState]
    --]
    

    And when you loaded a room you would search the array for enemies whose roomId matched the room id and load them.

    This would probably make your array smaller.

    Hope this helps...

    Cheers!

  • Good for you, pal!

    See? That's the attitude I was talking about. Good luck on that. LOL.

  • what happened in this forum

    maybe not have pro gamers in this forum

    We're game developers. Not gamers.

    And I think you might want to rethink your attitude on the forum. Just saying. You're definitely not getting much help with this attitude.

    Cheers!

  • What I mean is that when the floors are created they CAN be counted. The log IS counting them.

    But when I try to count them from inside the For Each JSON loop it returns ZERO.

    That makes no sense. How come they can be counted (even if they're "not added to the internal list of objects") in one situation but cannot, later on, in another situation?

    By the way, I already have an workaround since my first post. I just want to understand why this happens and if it was actually supposed to be happening. :)

    Also, waits in loops are not good practice.

    Cheers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, It's not. I debugged that and you can see on the browser log that all tiles are created BEFORE starting to create enemies.

  • Hi Everyone!

    This is probably something simple that I'm overlooking, but...

    I have a JSON for my levels where I store the map, the starting X and Y and a list of enemies on the following format:

    		{
    			"map": [
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,2,2,2,1,1,1,1,1,1],
    				[1,1,1,2,2,2,0,0,0,2,2,2,1,1,1],
    				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,1],
    				[1,1,1,0,3,0,0,0,0,0,3,0,1,1,1],
    				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,1],
    				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,1],
    				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,1],
    				[1,1,1,0,3,0,0,0,0,0,3,0,1,1,1],
    				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
    			],
    			"enemies": [
    				[5,8,1,32,4,0],
    				[9,8,1,32,4,0.5],
    				[7,8,0,0,0,0]
    			],
    			"x": 7,
    			"y": 7
    		}

    There are two types of enemies, stationary and moving (using sine). When I place the stationary enemies, I'm trying to get te nearest floor tile and destroy it, since it's below the enemy and players won't be able to change it (which is a victory condition).

    The problem is, when I try to access that tile from the for each loop it won't show. In fact, even "spFloor.count" will return 0.

    Here is the file. Any help is welcome.

    Cheers.

  • Hey urkokan!

    Check this file for an example of a simple GUI updating function.

    Hope this helps.

    Cheers!

  • Yes for both questions.

    Construct 3 is not that different from Construct 2, so your capx would probably be worth it anyway.

brunopalermo's avatar

brunopalermo

Member since 7 Jun, 2013

Twitter
brunopalermo has 6 followers

Connect with brunopalermo

Trophy Case

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

Progress

14/44
How to earn trophies