dop2000's Forum Posts

  • This is not an easy game to make for a beginner.

    I think maybe use a 9patch object to draw lines. When player touches one dot, you spawn 9patch and as the finger moves, increase 9patch width. When the finger changes direction, spawn a second 9patch at a different angle and so on.

    The tricky part will be to allow the player to leave the line unfinished, then return to it later. Or build two lines from both dots and then connect two ends together.

    Also, if levels are created randomly, you need to make sure that they are solvable.

    All this can be done, but the logic might be a bit complicated.

  • Either you misunderstand the purpose of containers or I misunderstood your question.

    Container itself is not an object, therefore there are no "container instances" and no container UIDs.

    Containter is a way to logically link together several instances of different objects.

    Only one instance of each object can be in a container.

    For example: 1 Enemy sprite, 1 EnemyHealthBar sprite, 1 EnemyName text, 1 EnemySkills dictionary etc.

    When you create an Enemy instance, all those other related objects will be created automatically.

    When you destroy the Enemy, all instances of other objects from the container will be destroyed as well.

    When one instance of any object is picked by an event, all other objects from the container are also picked automatically. So you can do things like this:

    Bullet on collision with Enemy -> EnemyHealthBar set visible

    or this:

    Mouse On clicked EnemyName -> Enemy start flashing for 1 second

    What objects are in your container? It's hard to tell from your screenshot.

    If you need to link multiple instances of one object to 1 instance of another objects, containers will not work.

    Say, if you want to group 1 HexCell, 7 Circles and 7 lines, you need to use instance variables.

    Usually, you select a "parent" object (HexCell) and add an instance variable "HexCellUID" for all dependent objects (Circles and Lines). Then you can pick them:

    Mouse On clicked HexCell

    ....Circle compare variable HexCellUID=HexCell.UID -> Circle set animation ...

    Or the other way around:

    Mouse On clicked Circle

    ....HexCell pick by unique ID = Circle.HexCellUID -> HexCell set animation frame to 1

    (If you are using Pin behavior, you can refer to pinned objects with built-in expression PinnedUID)

  • Oh, ok, here is the updated demo:

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

  • This event actually works and attack animation starts playing, but you have other events #18 and #19 on the PlayerEvent sheet that immediately change animation back to idle or some other one.

    You have a bit of a mess with different events setting different animations..

    I would suggest adding an instance variable "playerState" and set it to "run", "attack", "jump", "idle" etc. And then create a single event that changes animation when playerState changes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can add Drag&Drop behavior to the Boombox sprite in my example, move it around and see if the sound area follows it. (it does)

  • Yeah, character position could be saved in an array on every tick, and then "replayed".

    However, if there are lots of other moving objects, saving movement history for all of them could be a nightmare.

    Here is a plugins that may help:

    https://c2rexplugins.weebly.com/rex_tarp.html

    plugin-time-action-recorder-and-player_t79821

  • I really don't understand why there is no "Spawn" action. It's not a deal-breaker, you can always use "Create object" instead.

    Other than that I think SpriteFont is very similar to sprite.

  • Please post a screenshot of your event sheet, or share your capx.

  • You can also use instance variable to store array's UID.

    Add a couple of helper functions for setting/getting values in array by its UID and voilà - you have your array in instance variable.

  • No, you created something very weird <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I forgot to tell you that before playing the sound, you should check that it's not already playing.

    Anyway, here is the working example:

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

  • Thanks for the capx. So what's happening is when at least 1 enemy has line of sight, "Else" event is not executed for other enemies, which don't have LOS.

    You need to change your event to this:

  • If you are talking about the project size or performance, then no, adding Browser object doesn't affect that.

  • [quote:3w4z38dp]So when the enemy loses line of sight and doesn't have sight to anything else it should follow the ELSE code and set SeesEnemy to 0 along with EnemyX to 0 and EnemyY to 0, and then find path to its target (didnt screenshot that part)

    The error could be in that part. Could you share the screenshot of all events related to line of sight and pathfinding?

  • If by "using code" you mean "using events", then this works:

    Button Set Text to "?"

    If you meant "by numeric code of a character", add Browser object and try this:

    Variable charCode=981
    Button Set Text to Browser.ExecJS("String.fromCharCode("& charCode &")") 
    [/code:1qkt1a7i]
  • Not exactly...

    Your variable DistanceSoundBomb changes from 0 (complete silence) to 1 (full volume).

    If distance between objects is 1000 pixels or more, then it will be 0.

    You can change "1000" in that formula to 50 or whatever number you want.

    For playing/stopping sound you should use these events:

    System->Compare two values -> distance(detector.x, detector.y, bomb.x, bomb.y) is less than 50 -> Play sound

    System->Compare two values -> distance(detector.x, detector.y, bomb.x, bomb.y) is greater than 60 -> Stop sound