dop2000's Forum Posts

  • yavilink You can use a grid (tilemap) if it makes things easier for you. And there are many behaviors which you can use to move objects on a grid:

    TileMovement to move from tile to tile

    MoveTo - perhaps preferable in your case

    Tween

    Pathfinding

    etc.

  • This is not an easy task.. I have done similar thing using JSON and probability tables.

    You can create a JSON with all upgrade options and their weights/chances (in percents), for example:

    {"Prizes": [
     {
     "prize": "coins",
     "amount": 50,
     "chance": 5
     },
     {
     "prize": "coins",
     "amount": 100,
     "chance": 2
     },
     {
     "prize": "health",
     "amount": 10,
     "chance": 3
     },
     {
     "prize": "health",
     "amount": 15,
     "chance": 1
     },
     {
     "prize": "attack",
     "amount": 1,
     "chance": 7
     },
     {
     "prize": "attack",
     "amount": 2,
     "chance": 3.5
     }
    ]}
    

    So the chances to pick 50 coins as a possible prize is 5%, the chances to pick 10 health is 3% and so on. (Ideally all chances should add up to 100%, but not necessary)

    Then you create a probability table - feed all these items and their weights to the Advanced Random plugin:

    + JSON: For each entry in "Prizes"
    -> AdvancedRandom: Add entry JSON.CurrentKey with weight JSON.Get(".chance")
    

    After that you can pick three random values. They will be weighted, i.e. their chances to be picked will be based on the percentage you specified in JSON.

    | Local string randomPrize1‎ = 
    | Local string randomPrize2‎ = 
    | Local string randomPrize3‎ = 
    
    -> System: Set randomPrize1 to AdvancedRandom.Weighted
    -> System: Set randomPrize2 to AdvancedRandom.Weighted
    -> System: Set randomPrize3 to AdvancedRandom.Weighted
    

    At this point three variables will contain three random indices from JSON.

    You can access each prize in JSON, for example:

    PrizeText set text to JSON.Get("Prizes." & randomPrize1 & ".prize")
    AmountText set text to JSON.Get("Prizes." & randomPrize1 & ".amount")
    

    And based on that decide which variable to increase - gold, health or attack.

    .

    You can use an array to store all those options. I just find JSON easier to work with.

  • I suggest using Bullet behavior instead of MoveTo. With bullet you don't have to worry about the destination, you just specify the speed and moving angle.

    Make sure to disable "Set angle" in Bullet properties.

    You can also add "Destroy outside of layout" behavior, or use Fade behavior with long timeout to automatically destroy meteors when they are no longer needed.

  • Do you mean resizing in the editor? Or in runtime?

  • Instead of the container use hierarchy. Connect all objects to a hierarchy in the layout editor. Create the parent object and all child objects will be created automatically.

  • This likely happens because the bird sprite collides with the wall twice. It happens very fast, so you don't see it, but it momentarily changes its direction to the left, then collides with the wall again and changes direction again. Since the bird is already in the wall, further collisions are not registered and it continues flying to the right.

    You can try adjusting the origin point and collision polygons in all animation frames, make them strictly symmetrical. But the easiest solution is to add a cooldown period. After changing the direction, ignore further collisions, say for the next 1 second.

    You can use Timer behavior and check that the cooldown timer is not running. Or simply save the collision time in an instance variable on the bird. And compare (lastCollisionTime>(time-1))

  • You mean the data you saved in Local Storage while developing the game? It won't be exported of course.

    Every browser has its own local storage location, and it's separate for every website domain. Even if you play your exported game in the same browser you used for development, the storage contents will be different.

  • There are several examples in Construct editor, have you seen them? Search by the word "gravity"

  • GridMovement may not be the best choice here, because it stops after every cell.

    I would probably choose MoveTo behavior. Use raycasting of LineOfSight behavior to detect the nearest wall in that direction, then move to it.

  • I am also still confused on the Array size expression you mention. I currently don't have an array in use, just a Json

    Your JSON string actually contains arrays. "Scene" is an array, and "dialogues" is an array. If you see square brackets in JSON string - that's an array.

    So JSON.ArraySize("Scene.0.dialogues") for example will return the number of elements in "dialogues" array in the first scene.

    I suggest you read/watch some tutorials about JSON. It's not that complex and once you understand its structure, it will all make sense.

  • That's not the right formula.

    Use "Set value" instead of "Add value" and my formula from the previous comment.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can round the number every time you add 0.01

    Set var to (round(var*100)+1)/100

  • Same way - on every tick set text to its default position for all buttons.

    If mouse is over the button - offset text position.

  • This shouldn't happen if you organize the events correctly. Try this:

    On Every tick: Button Set frame to 0
    
    (sub-event)
    .... Mouse over Button : Button Set frame to 1