dop2000's Forum Posts

  • If you use one sprite, your function will look like this:

    You will only need ~20 events, instead of 200.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You already have Areas family. To start using it you need to move all variables from sprites to the family level. Check out this tutorial:

    construct.net/en/tutorials/upgrade-object-family-319

    But it may be even easier just to use one sprite Area with 9 instances. (delete all other area sprites).

  • (0.02/100) is not 2%, that's 0.02%. So if the isolation is 40-50, you are adding only 0.02%, but if the isolation is 10-20, you are adding 3.02%, which is 150 times more! Maybe that's why you are seeing such a big difference in numbers sometimes.

    Other than that I think your formulas are working correctly.

    But your code is extremely inefficient. Are you planning to duplicate events 23-57 for other 8 areas? This is a terribly wrong approach, don't do this!!

    Use a single sprite object for all 9 areas (make 9 instances of it). Or add all 9 areas into a family. Use the family in all events and you will be able to optimize your code by 80-90%!

  • Yeah, you need to post your code. Is it possible that you are processing areas multiple times? For example, if you have a loop and not picking the right area instance inside the loop, then "infected" variable will be incremented for all areas several times each turn.

  • Which of these variables are absolute values, and which are relative (percentages)? What is the value of infection_rate?

  • I never thought about this before, but I think all characters in the sprite font image need to be the same width. Spacing data is not used to determine character position in the image. It is only used to remove extra empty space from the right if the character is smaller than the default width.

    So think of the sprite font image as a tilemap - each character needs to be inside its own tile.

    I highly recommend using Spritefont Generator tool - it will format the image and generate the spacing data for you.

  • To add to plinkie's answer - events 11 and 12 on your screenshot are running on every tick. So if you are disabling Sine in some other event, these events 11 and 12 may immediately re-enable it.

  • Can you share your project file? Or a blank project with this sprite font added and configured?

    Also, what exactly is the problem - is the spacing data not working for all characters? or some characters?

  • jatin1726

    Can you share your C2 project file? Or email it to me: doperst2006diw@gmail.com

  • I'm telling you - the problem is with the order of events. When using Local Storage you need to wait before doing anything else.

    On start of layout -> read from Local Storage -> Wait for it to complete, only then compare variables!

    When level is finished -> write to Local Storage -> Wait for it to complete, only then switch to another layout!

    If you don't know how to organize this wait properly, you can simply wait 0.5-1 seconds, this should be enough.

    .

  • StorageData is a dictionary.

    The purpose of the dictionary in my demo is to save/load all values at once in Local Storage. When you have 50 variables that you want to save in Local Storage, you need 50 "Set item" actions, 50 "Check item exist" actions, 50 "On item exist" events... But if you put all values into the dictionary, then you can save it with just 1 "Set item" action, and load it with just 1 "Check exists" action. Much shorter and cleaner code!

  • Can you group these images into several sprites? Say, 100 images per sprite. Of course, if you need to display many random images from different sprites, this will use the same amount of memory as 1200 images in one sprite..

    .

    You can try packing the images into one or several zip files. Here is an addon that allows to extract files from zip:

    github.com/erenertugrul/construct-plugins/tree/master/plugins/jszip

    Although I don't know if this will work in an HTML5 game.

  • Can you post your project file? It's difficult to understand how the code works by the screenshot.

  • When animations are messing with movement, a very common solution is to use two objects for a character (you can put them into a container).

    One object "CharacterBox" is an invisible rectangle sprite with Pathfinding behavior. And the second object is your main "CharacterSkin" sprite with animations, pinned to that CharacterBox.

    Also, make sure that the Origin image point is set correctly in all frames in all animations.

  • Unfortunately, there is no simple answer. You can use a tilemap where each hexagon is made of 8 tiles, but programming something like this will be a complex task.

    .

    I have a demo project with hex grid, but I used sprites there.