winstreak's Recent Forum Activity

  • Local variables are reset each loop, so once you are done with your event that data is lost.

    The object has instance variables, these will be wiped as soon as the object is destroyed.

    Global variables can withstand this - but they are not designed to hold an objects stats since you can have many objects all looking for different values at the same time.

    Here is how I worked with destroying enemies in my last project.

    Enemies have a variable Boolean I set when they are killed and then I destroy them.

    In a new condition if an enemy is destroyed and also has killed true (This eliminates 2 swords killing the same enemy during the same tick) I can call my loot function while still having that enemies position and name stored. I then pass these into a function so I can use them after my enemy loses that information lose the information.

    (Mine is done with Families - but it should hold true with multiple of a single enemy as well)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ya call of that info before you destroy the other object.

    Or call a function and send in all the details you need as parameters before you kill the object. Every time I do this it just ends up being messy though.

  • Do all the create object mechanics before you destroy the old one.

    They are essentially instant so it will create and destroy at the same time to the users eye.

    If it needs to look destroyed first, create the new one as initially invisible and set it visible when ready.

    Or what lionz suggested if that is a possibility - sounds like it would save work.

  • You can do it in several different ways. I believe (could be wrong) that the most common for character stats is to give the object that is each character their own instance variables.

    So create an object - name it Player (or whatever) then add variables to player for MaxHP curHP Attack Def Speed Crit.... etc

    Then when player takes damage you would simply go "Player - subtract from curHP || damage

  • I think you are looking for a HUD.

    Create a layer - in the properties set that layers parallax to 0x0

    Now any images you have on this layer will ignore screen movement

  • Not quite following what you are trying to accomplish. But whenever I do non repeating randoms I use an array.

    Store all the combinations - and then remove each combination as it gets chosen from the array, so it is no longer an option.

  • If you set your actions to happen on key pressed and they are doing it on release, you most likely have other code that is still interacting and making it seem buggy.

    It is hard to guess at what that could be without seeing your code though.

  • Also make sure you remove things that are off screen and wont be coming back. No point to have a bullet you dodge fly around forever

  • I believe you want to check the Global checkbox in properties.

  • I also subscribed to your YT page as I was hunting for a way to buy you a hot/cold one for all the kindness.

    If you were serious you will be my first ever donator 😛:

    koji.to/winstreak

  • Feel free to hop on my discord - you can DM me any time

    discord.gg/NTQxEGH7Na

  • Since I was in there, a few other things you might like to add

    1. Every tick to display text changes is not going to effect your performance. I wouldn't worry too much about using every X instead of every tick for displaying text ever.

    2. Before we change trees we store the UID of the current tree. This way we can remove the highlight automatically

    3. Remove the highlighted tree - only if there was an old UID selected - only if it's not the same tree again

winstreak's avatar

winstreak

Member since 4 Dec, 2019

Twitter
winstreak has 11 followers

Connect with winstreak