dop2000's Forum Posts

  • Containers are easy once you understand how they work. Objects in the container only exist together.

    If one object from the container is created, all other objects from the same container will be created automatically. So you spawn an enemy and don't need to create its head! (but you still need to position it correctly and then pin).

    If you create a head, another enemy will be created.

    You destroy an enemy, its head will be destroyed too.

    If you put enemies and their heads onto the layout in editor and do this out of order, then you may attach wrong heads to wrong bodies! That's probably why all those weird things you mentioned are happening.

    To your second question - PinnedUID is an expression of Pin behavior. When you pin head to the enemy, Head.Pin.PinnedUID contains UID (unique ID) of the enemy instance. (Sorry, I missed the .Pin bit in my previous comment)

    So with this expression you can find the enemy to which the head is pinned using "Enemy -> Pick by unique ID=Head.Pin.PinnedUID"

    or you can find the head using "System-> pick by comparison Head where Head.Pin.PinnedUID=Enemy.UID"

    The third and very popular option is to create an instance variable EnemyUID on the Head sprite. When you create a new Head, you will need to put Enemy's UID to this variable.

    Then you can pick the Head using "Head -> Compare Instance variable EnemyUID=Enemy.UID"

    Or you can pick the Enemy using "Enemy -> Pick by Unique ID = Head.EnemyUID"

    Endless possibilities!

  • Container is the right way to do this. Add enemy and head into a container. When these two objects are in container, each pair of enemy+head instances will be logically linked together.

    If you place enemies on the layout manually in editor, put one enemy and one head first, then copy-paste them.

    If enemies are spawned during the game, you only need to create enemy object, head will be created automatically.

    Same with destroying - only destroy enemy object, its head will be destroyed automatically.

    If you want to do this without the container, you can use PinnedUID expression. Something like this:

    Enemy on destroyed:

    System-> pick by comparison EnemyHead where EnemyHead.PinnedUID=Enemy.UID -> EnemyHead Destroy

  • I've seen your post in C2 forum and I tried your project in both C2 and C3.

    If I look very-very closely to the screen, I can see a few pixels on the right side flickering just a little bit. But it's so minor that I would've never noticed it if I wasn't looking for it specifically. It's definitely not "flickery to the point of unplayability"

    So there must be something wrong on your side, maybe try updating video card drivers?

  • "CollectableSprite" is your sprite, I don't know how you named it in your project (could be "Coin" or something else).

    ".Count" is an expression, which return the number of sprite instances on your layout.

    Create a variable TotalCollectables.

    Add this event to your "On start of layout":

    Set TotalCollectables to CollectableSprite.count

    Then you can display TotalCollectables in that text:

    System-> every tick -> define text : Player.PlayerCoin & "/" & TotalCollectables

  • Use CollectibleSprite.Count to get the number of all instances of this object on the layout.

    So you can create a variable TotalCollectibles and set it to CollectibleSprite.Count at start of the layout.

  • Something like this?

    For "x"=0 to LayoutWidth/Sprite.Width

    ...For "y"=0 to LayoutHeight/Sprite.Height -> Create Sprite at (loopindex("x")*Sprite.Width, loopindex("y")*Sprite.Height)

    Origin point in the sprite should be at (0,0)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, since you are doing this on start of layout, you can mask this lag using some transition effect.

    For example, put a big black TiledBackground on top, add Fade behavior, set it to fade out and destroy after 1 second, then change your loop to this:

    for x=0 to 9     -> Wait 0.1*loopindex
       for y=0 to 999  -> Set Array.At(loopindex("x")*1000+loopindex("y")) = f(loopindex("x")*1000+loopindex("y"))
    [/code:12uzv96i]
  • Based on the very little information you provided, you might need Anchor behavior:

    https://www.scirra.com/manual/88/anchor

  • I see you fixed that issue with event groups.

    Instead of boolean variable isInteracting, use numeric interactingUID, with default value -1.

    Then change your events to these:

    Grabber interactingUID=-1
    Grabber is overlapping nMask  -> Grabber set interactingUID to nMask.UID
    
    nMask Pick by Unique ID = Grabber.interactingUID
    Grabber is NOT overlapping nMask  -> Grabber set interactingUID to -1[/code:10dl9stx]
    
    When Grabber.interactingUID is set, you can easily pick nMask instance by UID in other events.
  • You don't really need currY variable, you can use loopindex*75

  • saeris

    Seems like R0J0 found a better solution (as he always does )

    Anyway, SpriteFont has a number of expressions (characterHeight, characterWidth, characterSpacing, lineHeight), which you can use to calculate the screen position of any character in your text. So if you need to highlight the word "John", you find coordinates of letters "J" and "n" and put some sprite with blend mode in that position, or draw a line underneath. It's not an easy task, but possible.

  • FabianB

    If you have two objects with scrollTo, view will be scrolled in between them.

    It's hard to help if you can't explain the problem. Maybe you could share your capx? Or post a link to youtube video with the same camera effect?

  • See this post:

  • No, I'm pretty sure in terms of performance they are the same.

  • Not sure if I understood you correctly.

    So when player collides with red switch, you want to open the red door? On collision with blue switch, open blue door and so on?

    Add "Color" instance variable to both Switch and Door sprites. Set correct Color for each switch and door ("red", "blue", "green" etc.)

    Your code could look something like this:

    Player on collision with Switch
       Door compare instance variable Color=Switch.Color  -> Door set isOpen=1
                                                             Door set animation to "Open"
    [/code:641e481b]