Anchors and spawnpoints

0 favourites
  • 7 posts
From the Asset Store
Set forth on an epic journey across the seven seas with AAA Game Character Pirate!
  • I finaly figured out there was a thing called anchor, so I opted to change my spawn system to only have a few anchored at the edge of the screen instead of tons put on the map.

    When I did this change, I noticed that npc's only spawn from the green box with an arrow on the right side of the screen, but never on the others. Any pointers on what the problem might be?

  • That formula for RND is wrong. Values 2,3,4 will appear more often than 1 and 5. Sometimes no pedestrians will be spawned, or several pedestrians can be spawned at the same time.

    If you need to spawn 1 pedestrian every 1 second, instead of RND use "System Pick random instance" event.

    So remove "RND=1" condition, add a sub-event under event #7 and put "System Pick random Spawners" there.

    If this doesn't fix the issue, the problem may be with two other conditions - Spawners overlapping sidewalk, and Spawners is on-screen. You can try to debug it. For example, in event 6 set Spawners opacity to 50. In event 7 set their opacity to 100. You should be able to see which spanwers are picked by event 7 (overlapping sidewalk and on-screen), they will have 100% opacity.

  • That formula for RND is wrong. Values 2,3,4 will appear more often than 1 and 5.

    Why is that? I also use this type of 'odds' technique now and then.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • since the random range is 1 to 5 and then rounded, you will get the following results:

    1 to 1.49 = 1

    1.5 to 2.49 = 2

    2.5 to 3.49 = 3

    3.5 to 4.49 = 4

    4.5 to 5 = 5

    so, 1 and 5 have half the chance to be picked as 2, 3 and 4

    you should use: choose(1,2,3,4,5)

    or use floor or ceil to make sure everything is rounded the same way to make the chances equal.

  • ... or floor(random(1,6)) or int(random(5)+1)

  • Thanks. That's good to know. I will use floor from now on or choose, those seem to be the most easy to remember.

  • Thank you guys! Got it working. I'm having a hard time with these math things, heh.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)