dop2000's Forum Posts

  • This doesn't make sense. "Is on screen" works fast, I tested it with 10000 objects and it didn't make any noticeable difference in performance. Definitely shouldn't matter for 50 objects.

    In your case you don't really need this check, because you are only changing a bunch of variables. It's useful when you have CPU-intensive behaviors applied on objects, like Platform or Physics. Then you can disable these behaviors when objects are off-screen and improve performance.

    I don't know why your code runs faster with this condition disabled. I'm guessing that off-screen object instances have empty values in these variables (direction, animation, lastX, lastY) and some other events don't work effectively with them.

  • Here is my version:

    dropbox.com/s/3kjdpsn1nizae56/PlatformerWithShadow.capx

    Note that the shadow has Source Atop blend mode and should be on the same layer with platforms.

  • You can simply check for "Overlapping at offset":

    Character Is Overlapping SolidFamily at offset X=0, Y=-2

  • I think this can be done a bit easier, with a single string variable.

    On each key press add this key to the end of the string, and check if the last characters in the string are "SDB". If no keys pressed for 1 second - reset the string to "".

    Here is how I added Doom cheat codes in my game:

  • On collision with ground you can check the bullet speed (to know if the ship landed or crashed), then disable Bullet behavior.

  • You don't need physics, this can easily be done with Bullet behavior.

    On collision with the ground check rocket bullet speed and if it's small enough, then it landed successfully.

  • brunopalermo is right, if you simply need to set different values for two variables, event groups is a huge overkill.

    If you don't like his solution, just create one variable Difficulty and a function SetDifficulty:

    Function SetDifficulty
    	if Difficulty=1 : set life=50, lifeMax=50
    	else if Difficulty=2 : set life=100, lifeMax=100
    	else if Difficulty=3 : set life=200, lifeMax=200
    

    When player chooses game difficulty, set the variable, write it to local storage and call this function.

    On start of layout read this variable from local storage and call the function:

    On start of layout
    	Local storage get "difficulty"
    	System wait for previous action
    	set Difficulty=max(1, LocalStorage.ItemValue)
    	Call SetDifficulty()
    
  • You can add NoSave behavior to things you don't want to save.

  • Look at your AJAX request action, why are you requesting "icon-128.png"? You need to request URL NWJS.ChosenPath

  • .

  • It's easy actually. Run "System Save" action, then in "On Save complete" event expression SaveStateJSON will contain all saved data. To save it to disk with any extension use "Browser request download of string" or "NWJS Write text file".

    To load - read the file from disk into a string variable and use "System Load from JSON".

    .

    It's also possible to compress data (as files in JSON format may be pretty large). See this plugin. And again, you don't need to use "zip" extension for compressed files, you can choose any extension you like.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you need to play the same sound several times, try this:

    Repeat footstepsTime
    	Wait loopindex*footInterval
    	Play "Foot"&groupNumber
    
  • Yes, this is possible - you can add several copies of ReplaceColor effect, each will replace one color. Changing effect parameters with events is a bit cumbersome, so I would probably store all colors in an array and use a function to swap them.

    There may be custom effects allowing to do the same easier, try searching this forum:

    construct.net/en/forum/extending-construct-2/effects-31

  • Thanks, Bruno!

  • :)