dop2000's Forum Posts

  • newt What do you mean? I thought picking conventions are always the same, no matter which event was used to pick instances.

    And why "AND" block with the same conditions works fine (respects the set of instances picked by parent event), while "OR" block doesn't?

    Here is the code in a nutshell:

    // a=1 for all instances
    // b=1 for all instances
    // c=1 for one instance
    
    System Pick Sprite with c=1    // only one instance is picked
        
        Sprite.a=1
        Sprite.b=1    // Correctly picks just one instance
    
        Sprite.a=1
        or
        Sprite.b=1    // Incorrectly picks 4 instances
    [/code:18m5yq6f]
  • Use TileMap object, it would be perfect for the task. You can find a few tutorials here:

    https://www.scirra.com/tutorials/all

  • This is not a bug. You need to follow this tutorial to embed the font into your game:

    https://www.scirra.com/tutorials/237/ho ... -web-fonts

  • Problem Description

    In parent event "System->Pick by comparison" or "Pick by evaluate" is used to pick some sprite instances.

    If "Or" block is used as a sub-event, it ignores picked scope and evaluates all instances of this sprite instead.

    Attach a Capx

    https://www.dropbox.com/s/98slz4y9w6clo ... .capx?dl=0

    Description of Capx

    A very small and well-commented example demonstrating the problem.

    Steps to Reproduce Bug

    Run the CAPX

    Observed Result

    Parent event "System->Pick by comparison" picks only one instance of Node sprite.

    In sub-event ("Or" block) the Node.pickedCount suddenly becomes 4.

    Expected Result

    In all sub-events picked count should not exceed 1.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 8.1

    Construct 2 Version ID

    Construct 2, Release 246

  • Your event #7 has two contradicting conditions (platform moving AND platform not moving), so it will never be triggered.

    Same with event #9

    Change them like this:

    Or you can use "Else":

    Platform is moving -> Set animation to Run

    Else -> set animation to Idle

  • You can make a grid with square sprites and use "Pick nearest" to find the nearest cell.

    Or use a tilemap, it has SnapX and SnapY expressions.

    Or you can do it with math. Say your grid cells are 10*10px. And player drops a piece at x=77, y=22

    Use these formulas to find the nearest cell:

    nearestX = (round(x/10)*10)=80

    nearestY = (round(y/10)*10)=20

    Once you know the destination coordinates, you can move your piece there using a behavior like MoveTo or LiteTween.

    Or without any behaviors:

    On every tick

    Piece set x to lerp(piece.x, destinationX, dt*4)

    Piece set y to lerp(piece.y, destinationY, dt*4)

  • You can try a trick with a family.

    Create a family with sprite A.

    Then use "FamilyA spawn A"

    "A.UID" in this event will refer to UID of a newly spawned instance.

    Or you can use "System->Create" action:

    Function call "CreateNewA" (A.x, A.y)
    
    On function "CreateNewA" 
       System-> create new A on layer 0 at (function.param(0), function.param(1))
       A set instance variable ....
    [/code:1kr5a5k7]
  • I noticed that "Destination out" blend mode with "Force own textures=yes" set on the layer costs about 10-15 fps in performance drop on my older mobile phone.

    I'm going to disable this blend mode on slower devices and use an alternative (less nice looking) effect.

    So I have 2 questions:

    1. What's the best way to measure performance? I'm thinking when the level starts, collect fps on every tick for about 5 seconds, then calculate the average fps. If average fps<30, then disable blend mode.

    Is there a better or more reliable way?

    2. Is is possible to get masking effect without the "Force own textures" setting?

  • What do you mean by "spawned by itself"?

    If you have sprite A which spawns sprite B, you don't need to know B.UID, you can simply do this:

    A spawn B

    B set instance variable ....

  • Create another variable "oldX"

    If X not equal oldX -> Set oldX to X; and do other stuff you need to do

  • CreativeMind

    Could you share you code please? I'm making a simple Arkanoid game and would also like to adjust ball angle depending on paddle speed. I'm using Bullet behavior with "Bounce off solids=yes".

  • It's probably because you are restarting it in your first layout.

    Add a condition "If NOT Audio tag 'music' is playing", so that the music wouldn't restart if it's already playing.

  • Looks ok, but change the names - the sprite should be named Wolf and the family should be Enemies.

    Do the same with Player and NPC, add them to Friendlies or Allies family. But only move instance variables and behaviors that both Player and NPC have (and future allies will have). For example move Mana and Health to the family, but ScrollTo behavior should remain at Player sprite.

    After you do that, you should be able to remove the whole WolfAttackNPC group and maybe optimize lots of other events in your project.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Containers are useful for objects that exist together. For example - Enemy, EnemyShadow, EnemyHealthBar.

    They save you a hassle of creating/destroying each object separately.

    Also, all three instances of these objects are logically linked. So when you pick one enemy in an event, you can refer to its shadow and health bar in the same event without the need to pick them by EnemyID.

    No, replacing "wolf" sprite with "wolf" family makes no sense... Will wolf be the only enemy type in your game? I guess not. So your family should be called Enemies. And your wolf sprite should be called Wolf. If you add Bear, Goblin etc, you add them to the Enemies family and they will inherit all Enemies instance variables and behaviors.

    Have you followed that tutorial and moved wolf's instance variables and behaviors to the family level?

  • This should work:

    Door overlapping Ground
        System-> Pick 0th Ground instance  :  Door Set room1=Ground.room
        System-> Pick 1th Ground instance  :  Door Set room2=Ground.room
    [/code:mbk8dw2f]
    
    You can also use Ground.pickedCount expression to check how many Ground instances are picked in this event.