dop2000's Forum Posts

  • Yes, of course you can set the value to some variable.

    Dictionaries are perfect for use together with local storage, because you can easily save and load a lot of information at once.

    If you are saving each variable separately in LocalStorage, you need a million of events to save and retrieve each item. If you are saving a dictionary, you only need a couple of events.

    .

    I also suggest keeping dictionaries not just to store data in local storage, but actually using them in your game. For example, you can have a dictionary GameSettings, with keys like "MusicVolume", "SoundVolume", "Difficulty" etc.

    You don't need to create variables with the same data, just use the dictionary, for example:

    Audio set volume to GameSettings.Get("MusicVolume")

  • Global variables are not always evil, but in this task (where you need them to store information about lots of objects), they are a very bad choice.

    Instance variables is a good choice for this task, they are much more efficient. You can have 100 items and only 10 instance variables to store all items properties. (With global variables you would have to create several hundreds of them and many-many more events)

    .

    If you have multiple of sprites with similar features, you need to combine them into a family. If you have, or planning to have sprites Player1, Player2, Player3, Player4 - add them to FPlayer family and move all instance variables, all behaviors from sprite level to family level. This will save you a lot of time and efforts in the future and you could organize your code better. For example - instead of four almost identical events "On player1 jump - do something..." you can create just one event "On FPLayer jump".

    .

    I recommend doing the same with items - you can make an individual sprite for each item, but you need to combine them all into a family.

    Individual sprites are probably even better for this job. You can keep them all on a separate (unused) layout "ItemsInstances", fill in all the values into their instance variables. And this will become your database of all items and their properties. When you spawn an item in the game, it will be created with all those properties you defined.

    .

    Don't worry about the Save feature, it saves everything - global variables and instance variables.

  • You can check if multiple points under the character are overlapping the ground or not. Depending on which points are overlapping, adjust the character angle and angle of gravity.

    Another possible solution would be adding invisible sprites (circles, rectangles) to the layout. When character is overlapping these sprite, set its angle to sprite center, or away from it.

  • So many questions..

    If you have lots of different items with lots of properties and you want to generate one at random, you need an organized way to store all this information. Lets call it the database. In C3 probably the easiest way to do this is with arrays (because of the Array Editor).

    My example project has this database, you can add more items to it and more properties, just need to create functions to retrieve them. You can have multiple arrays (say, one for weapons, another for consumables).

    .

    .

    Here is how you can do this without any database:

    If you were placing all these items manually onto the layout (for the character to find), you can store all information directly in sprites.

    Create a few sprites - Weapons, Potions, Food, Tools (or Basic, Legendary, Rare, whatever) with multiple animations.

    Add them all to ITEMS family, and define a bunch of instance variables on the family, for all possible items properties - "damage", "run_speed", "jump_strength", "price" etc..

    So when you place these sprites on layout, you will need to manually set an animation and enter values into these instance variables.

    E.g.: animation="small_sword", damage=10. Leave unused variables empty.

    .

    So how do you give a random item to the player?

    You can put all these items off-screen, all hundreds or them.

    When player picks up a Randomizer, select a random instance of ITEMS family and move it to player's position.

    .

    It's your game, so you should decide how are you going to do this.

    One thing I know for sure is that making hundreds of global variables to store all this data is definitely a bad idea.

  • Dictionaries are actually very simple, much easier to understand than arrays.

    They are like variables, only more flexible. Just add keys and values, for example:

    Key="Coins", value="35"

    Key="Weapon", value="small_sword"

    etc.

    .

    Then save to local storage Dictionary.AsJSON

    To load: Dictionary load from JSON (LocalStorage.LastData)

    .

    I made this demo for some other post:

    dropbox.com/s/1cz1k5x3teikbv5/DictionaryLocalStorage.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dt is the frame duration.

    If your game runs at 60 FPS, dt is approx 0.017s

    So 50*dt=0.83

    .

    At 50 FPS, 50*dt will =1

  • Try searching for the same topics in google and open cached results. If google cached the old page (on scirra.com), you will be able to see the download links.

    Also, you can browse some posts from 2016 saved on web.archive:

    web.archive.org/web/20160519014331/https://www.scirra.com/forum/completed-addons_f153

    .

    Tom from Scirra is working on restoring the links in posts, he assured that they are not lost and will be recovered soon.

  • Also, I just realized if T is tapped but not held during the full duration of the timer, it locks the ball from ever being spawned because it sets the value to "false" but it did not work using "is down" either.

    This shouldn't happen with the code you posted earlier, because the timer is stopped every time T is released.

    Also, it may be easier to do this charging thing without the timer and Basketball variable. Add a variable chargeKeyPressed, change your code to this:

    On T pressed : set chargeKeyPressed=time
    
    On T released 
     chargeKeyPressed<(time-1) : Spawn ball
    

    .

    Also it's getting really annoying waiting for moderator approval on every reply I post

    This happened to me once. Maybe the more comments you post, the less often they need approval?

  • You should use "System On Load Complete" event or "System On Load Failed" to switch to another layout.

  • You can stop the bullet completely after several bounces, or when the speed is quite low (<10 for example).

  • Try changing your code like this:

    .

    To slow down the ball after each bounce you can add this event:

    Ball on collision with Floor -> Ball set speed to (Self.Bullet.Speed/2)

  • Tom,

    Searching is not a problem. The problem is that 90% of search results are worthless, because all links in old posts are missing.

    There are no capx examples, no links to plugins, no screenshots, nothing!

    The entire subforums ("Completed Addons", "Effects", "Tools and Resources") are now basically useless because links in posts are lost.

    .

    I know you wrote that formatting in old posts will be fixed, but could you please confirm that the missing links in posts will be restored as well?

    If not, you need to find the way to somehow make the archive of the old scirra.com forum accessible.

  • There was an announcement a few weeks ago, that private messaging will soon be removed from the forums. So yeah, all PM messages are now lost.

  • Several seconds?! You must have a very big map or very small pathfinding cell size..

    Anyway, you can use "Regenerate region around object", this should work much faster.