ome6a1717's Recent Forum Activity

  • Hey Xavier,

    For some reason the CLEAR button doesn't seem to actually set the array to all 0's Is this a bug in C2, or does it not do that?

  • I like the idea of using an array, but I've never used them before, so bare with me.

    Here is what I did (and maybe you can tell me what I'm doing wrong):

    When an enemy is killed, I'm using the following event:

    Enemies > On Destroyed

    _____________-Array > Set Value at Enemies.ID(instanced variable) to 1

    On the save button, I'm using:

    Webstorage > Set Local Key "Array" to Array.AsJSON

    On load:

    Array > Load > JSON string "Array"

    When the layout start, I created a subevent:

    Array > Value of Enemies.ID = 1

    For Each Enemies

    ____________- Destroy Enemies

    The other thing is that I want all enemies to respawn when you leave the level and go back into the level, so I added a "Array > Clear" event for that, but it doesn't seem to be working either.

    Thanks!

  • But when you restart the layout, it resets all of the instance variables. That's the issue - the only true way to do it (in my head at least) is to create a global variable for each enemy on the layout and once they are killed, set the global variable to 1 and destroy the enemies on layout start that way.

  • Hey Vee,

    Thanks for the response. Sorry to sound ignorant, but can you kind of walk me through what each of these lines are doing? I'm a bit unfamiliar with tokencount/tokenat/loopindex/append :P

  • The enemies aren't actually spawning, though - they're set in the editor and when you "Load Game", it restarts the layout.

  • I have a game where enemies are placed in specific spots on purpose. When I kill an enemy, save, and load that game, the enemies re-spawn (for obvious reasons).

    Is there a way around this without having to create billions of global variables?

    I am using WebStorage to save the current variables.

    Thanks in advance!

  • Adding "For Each Enemies" above "For Each IceBlock" seems to have fixed the issue.

    Thank you guys!

  • Hey Jaycephus,

    Your assumption is correct - it's not deleting all of the iceblocks. The enemy is always frozen as it should be, but occasionally when the 3 seconds is up, one of the iceblocks will NOT be deleted. I can't figure out a way to trigger the bug, either.

    Just curious (I'm not at home to test this yet), but if I change the code to "Pick all IceBlocks", won't it delete them all instead of each one individually once the freeze timer is up? (ie. if an enemy is hit by frostnova, and a further enemy is hit by frost nova 1 second later, they should each have their own timer for when iceblock is deleted so they are NOT deleted at the same time).

    Let me know if I'm not making any sense.

    Thanks.

  • I actually don't need the for each, but regardless of whether or not it is there, it still seems to have this issue.

  • I cannot figure out why these lines of codes only work ~90% of the time when multiple enemies are on the screen and affected by this.

    <img src="http://stevemazzaro.com/FrostNova.png" border="0" />

    Basically what is happening is when the enemy is hit by FrostNova, if it's not already frozen (Freeze = -9999), it spawns an iceblock on an enemy and "Freezes" it for 3 seconds. Once the 3 seconds is up, it destroys the iceblock and unfreezes the enemy.

    If there is only 1 enemy on the screen, it works perfect every time, but the second you introduce 1+, it seems to get more complicated. With 2, it will usually delete both of them, but randomly will leave 1 undeleted while the enemy acts unfrozen.

    Can anyone see anything wrong with this? Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Vee - you are my hero.

    Thanks!

  • Hey Vee, thanks so much for taking the time to do this. I noticed one thing in your current capx file. The move angle works perfectly, but the collision with Rock no longer works properly.

    Any idea why this is?

ome6a1717's avatar

ome6a1717

Member since 12 Feb, 2013

Twitter
ome6a1717 has 3 followers

Trophy Case

  • 11-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

13/44
How to earn trophies