dop2000's Forum Posts

  • Magistross

    I just tried "On every tick > Repeat 1000 times > compare distance" and got 60 FPS and only about 5% increase on CPU utilization.

    So unless OP wants to do this check tens of thousands times on every tick, he should be fine.

  • naaah, ur worrying too much my dude! Knock yourself tf out, hell, make 5 underProfile visuals for those NPCs!

    Seriously, it should be fine.

    Don't use "every 0.01s", this is less than 1 frame duration. Use "Every tick" or you can simply pin sprites with animation to your NPCMask sprite.

    Also, it may be easier (less messy) to have different sprites for male, female, child etc. Add them all to a family "NPC" and you can control them all as instances of one object. Different sprites can also save some memory on levels where you don't have all NPC types. But there is nothing wrong in doing this your way (with all animations in one sprite), and there should be no big difference performance wise.

    You can try a stress test before you start making the game - put several animated sprites the size of your NPCs on the layout, add Bullet behavior. Make 40 copies of them, and see what what numbers you'll get for FPS and CPU utilization.

  • There is a setting in Bullet behavior "Set angle", change it to No.

    Use "Bullet Set angle of motion" event to change direction.

  • Matei511

    Not sure why can't you use containers. Anyway, here is a demo with and without the container:

    https://www.dropbox.com/s/86z09er4o3e75 ... .capx?dl=0

    Oh, I see you need to pin multiple instances to one object. Then yes, your method is ok.

  • You can try adding another condition to event 806: Enemy Health>0

    If this doesn't help, add some debug output to event 801, for example Browser->Log "Collision:" & Enemy.UID

    This will tell you how many times the collision happens. It may be possible that when you apply vertical velocity, player collides with the enemy again, or maybe your enemy has some weirdly shaped collision polygon.

  • You can put an invisible tilemap with just one tile type and Solid behavior. Set tiles where your water is on the map and your character will not be able to move there.

  • Why not just use the distance expression?

    distance(sprite.x, sprite.y, player.x, player.y)

  • Short answer - not possible.

  • If you add Black and Red sprites to the same container, then they will exist in pairs. You will be able to simply do "Pin Black to Red".

    If you don't want to use container, try this code:

    System-> For x=0 to Red.count-1
       System -> Pick Nth instance of Red instance=loopindex
          System -> Pick Nth instance of Black instance=loopindex   :   Black pin to Red
    [/code:34g0bdhh]
    
    In both cases sprites will be pinned to each other in the order they were created. Black sprite with lowest UID - to Red with lowest UID and so on.
  • I'm not sure I understand.. Could you share you capx? (you can PM it to me)

    Or create a small project that demonstrates the problem?

    By the way, if I'm not mistaken, screen center on a layer with parallax 100,100 is always at (scrollx, scrolly)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is how you can do this in one action:

    Set FlipGravity to (FlipGravity=0)

  • I found a few posts that could help:

    Edit: this is how you convert coordinates from layer 1 to layer 0 (when sprite located on layer1):

    CanvasToLayerX("Layer 0",LayerToCanvasX("Layer 1", sprite.X, sprite.Y) ,LayerToCanvasY("Layer 1", sprite.X, sprite.Y))

    CanvasToLayerY("Layer 0",LayerToCanvasX("Layer 1", sprite.X, sprite.Y) ,LayerToCanvasY("Layer 1", sprite.X, sprite.Y))

    For example, to fire a bullet from gun on layer 2 at player on layer 1:

    Create object Bullet on layer 1,

    set X to CanvasToLayerX(1, LayerToCanvasX(2, Gun.X, Gun.Y), LayerToCanvasY(2, Gun.X, Gun.Y))

    set Y to CanvasToLayerY(1, LayerToCanvasX(2, Gun.X, Gun.Y), LayerToCanvasY(2, Gun.X, Gun.Y))

    Set Bullet angle of motion to angle(bullet.X, bullet.Y, Player.X, Player.Y)

  • There are only a few expressions in C2 related to scrolling - ScrollX, ScrollY, LayerParallaxX and LayerParallaxY.

    And, as far as I know, there is no such thing as scroll rate.

    I'm not sure how any of those can be related to "overlapping on offset" (there is no "collision at offset" either).

    Are the objects that you need to check for overlapping located on layers with different parallax setting?

  • I'm not a big fan of arrays in C2. I repeat this almost in every post where arrays are mentioned <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I'm convinced that many things can be done much easier with objects and instance variables instead of arrays.

    Anyway, here is a demo where cards are moved like you want. I used an example from your other post, modified and simplified it (by removing arrays <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> )

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

    You will need MoveTo addon to open it. It's a great behavior and I highly recommend installing it.

    If you change "order by" to spCard.cardFace in event 10, then cards in hand will be arranged by their suit and value.

  • Yes.