dop2000's Forum Posts

  • I should have said "it's not easily done"

    brair_user, why can't you use the collision polygon? If you need it for something else, then you can try this workaround:

    Create an invisible clone of the sprite, Pin it to the main sprite, define correct collision polygon on the clone sprite and use it for collision detection.

  • Not sure I understood your question.

    If you want to compare two coordinates you can create this event:

    Int(pixA.x)=Int(pixB.x)

    Int(pixA.y)=Int(pixB.y)

    System->Trigger once

    Or do you mean you need to detect when two sprite images (not collision polygons) are collided?

    I don't think it's possible.

  • So your layout is bigger than window size? How do you scroll it?

    Usually in games like this you add ScrollTo behavior to your character and set Parallax=0,0 for your HUD layer. And that's it, everything scrolls automatically except for the HUD.

  • You need to pick one member of the family first.

    How do you select which unit to attack with? Do you click it with a mouse or something?

    Then I'm guessing you have an event like this:

    On object PlayerUnitsFamily clicked

    Inside this event the correct member (instance) of the family will be picked and PlayerUnitsFamily.damage will refer to this picked instance.

    There are lots of other ways to pick instances, this is probably the most powerful and important concept in C2.

  • I think the reason why Alextro's example is slow with 120 pieces is not the layers, but the fact that each piece is actually a copy of full-size animation trimmed using blend mode.

    So yeah, this is not a very good method for big puzzles.

  • Where do you define damage amount for each player's unit?

    If you have "damage" instance variable on PlayerFamily and "health" instance variable on EnemyFamily, then it's should be very simple:

    Subtract (PlayerFamily.damage) from EnemyFamily.health

    If this doesn't help, please share your .capx

  • Try Pin behavior - select Mode: Rope or Bar style.

  • "dt" is frame duration and at 60fps it's always approximately 0.016

    That's why your formula always returns the same result.

    You can try this:

    X=lerp(X, -600, 0.5*dt)

  • Try this:

    If random(100)<20 then drop item

  • LiteTween is an overkill for this task if you just need a linear change.

    X=X-300*dt is the easiest formula

    If you don't care about it taking precisely 1 second, you can simply subtract 5 every tick:

    X=X-5

    At 60fps it would take approximately 1 second to decrease by 300.

    You can do this with lerp if you want, but you will need another variable "t":

    t=t+dt

    X=lerp(-300, -600, t)

  • If you need to change from -300 to -600, that's actually decreasing

    Try this:

    X=X-300*dt

    This should decrease X by 300 every second.

    To stop after 1 second, you can either set a condition "If X>-600" or add Clamp() or Max() expression, for example:

    X=Max(-600, (X-300*dt))

    If you want easing effects (speeding up/down etc), you can install LiteTween behavior.

  • Why did you remove 4 actions from the "DisplayINVContent" function? Restore them and your inventory will work.

    Did you delete and then re-added invCell sprite or Collectibles family? You should be careful when you delete an object in C2, as all events and actions mentioning this objects are automatically removed from the event sheets.

    I suggest you compare your code with the previous version (the one you uploaded a few days ago) to make sure nothing else is missing.

  • sean080

    It's the same check as in my example - if distance between two sprites less than some value, then enable bullet behavior.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See this example:

    The system will check event 1. If it's true, other checks will not be performed.

    If 1 is false, then event 2 will be checked.

    If 2 if false too, then event 3 will be executed.

  • You can have several Else conditions:

    A=1  ....
    B=1
    
    Else   ....
    C=1
    D=1
    
    Else ....
    [/code:1ym1hzxh]
    
    I should note that this kind of programming is not very efficient. If you have lots of events like this or add more variables, your code will soon become very difficult to manage. You should probably choose another way to store all these values, maybe a dictionary, or an array. You can store recipes  as strings of keys: (BigTowerRecipe="burger,piper,maioneza") and use tokenat, tokencount to parse them and loop through the dictionary to check if ingredients are available.