mekonbekon's Forum Posts

  • It depends upon the dimensions of your tilemaps - if one of the maps is larger than the other then the smaller one may be picked as being closer, even if the player overlaps more of the larger, because the origin of the smaller tilemap is nearer to the player's origin. There is also another issue: the tilemap object's origin is in the top left corner and can't be changed, so in order to find the centre you would need to add 0.5*tilemap.width to tilemap.X and 0.5*tilemap.height to tilemap.Y.

    Could you explain what the new problems are? It will be easier to suggest solutions if you can outline all of the constraints.

  • You can use the "pick overlapping point" system condition to select the tilemap that the player sprite's x,y is overlapping, and then use the tilemap's PositionToTileX PositionToTileY expressions to pick the tile:

    dropbox.com/s/l2f29kxcicb39bz/pickTilemap.capx

    Note that the player's origin would need to be centred in order to pick the tilemap that the player was most over. If you can't have the player origin in the centre then you can add an extra image point in the centre and use those co-ordinates to pick the tile map (using player.ImagepointX(1), player.ImagepointY(1))

  • Containers are your friend. If you check on the properties bar for the enemy you'll see a container option - click create and add the components of the health bar to the enemy's container. Now when you spawn an enemy it will also be spawned with its own health bar.

    You will need to pin the bar to the enemy on creation.

    Whenever you pick the enemy using conditions its health bar will also be picked and any actions will only apply to that enemy's bar.

    You can learn more about containers here: scirra.com/manual/150/containers

  • On leaving layout 1 you could save the name of the layer that the player sprite is on to a global variable and then on start of layout 2 move the player sprite to that layer using the global variable in the "Move to Layer" action. Likewise on transitioning back from 2 to 1.

  • You can do this using the drag and drop behaviour on the cards and the SnapX and SnapY expressions on a tilemap object for the grid:

    dropbox.com/s/iq4wf3vsk2p4fd8/SnapToGrid.c3p

  • You need to pass the UID of the button to the function:

    dropbox.com/s/djgbxd6l47ylygg/pickButton.c3p

    EDIT: Oops, sorry Dop, didn't see your reply!

  • Big thanks dop2000,

    Your demo pointed me in the right direction - I ran with it and came up with this:

    dropbox.com/s/jhxbs17qufnjdh5/FillTheBlankWord2.capx

    This version also allows you to delete letters and then test the word by pressing enter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a text object (txt_fact) displaying a sentence that includes one word replaced with a line of blanks. I want the user to be able to replace the blanks with the missing word, or at least write on top of the blanks.

    Currently I use the following method:

    1. Add a second text object (txt_answer) that sits over the blanks in txt_fact.

    2. Add a textbox object with the CSS set to render it invisible.

    3. Focus the textbox and set txt_answer to display whatever text is typed into the textbox.

    This would work fine, except fonts in a text object display differently depending upon the browser/device, so I can't guarantee that the position of txt_answer will always lie precisely over the blanks.

    Is it possible to derive the coordinates of characters in a string? e.g. find x,y for the 3rd "_" in "I laughed at the _______ dog."

    Failing that, is this something I can handle with regex? I figured I might be able to use a replace expression, but I'm unsure how to handle the user deleting characters that have been added once the blanks have been replaced.

    Or maybe there is another way?

  • I've also popped a few neurons trying to decipher the debug output from 3D arrays.

    Ashley maybe it would make things a little bit more readable if the z layers were bracketed?

    Fengist's x=0 would then look like:

    (370,-1,-1,-1),(222,-1,-1,-1),(913,-1,-1,-1)...

    ...which is a lot easier to parse.

  • You can use the conditional operator "?" in expressions as follows:

    variableA="player"?"PLAYER":"ENEMY"

    Which translates as "if variableA equals "player" then set expression target to "PLAYER", else set it to "ENEMY".

    You can stack these up as follows:

    variable=1?A:variable=2?B:C

    As you mention, "|" is the OR operator; "&" is the AND operator.

    There are more operators here:

    construct.net/en/make-games/manuals/construct-3/project-primitives/events/expressions

  • No problem :-)

  • You're welcome :-)

  • You can shuffle a 1D array to create a randomised sequence of numbers, then step through them:

    dropbox.com/s/thbz3x5ze4lhy9e/arrayShuffle1D.capx

  • Open the C3 start page and check out the game templates and examples - there are lots of simple games there to get you going.

    Whilst playing through the examples have a think how you could modify the mechanics to make them more interesting and extend the gameplay.

    I put together this tutorial a while back that you might find useful:

    construct.net/en/tutorials/designing-itsy-bitsy-games-1116

  • You can create as many probability tables as you want. You need to set the table before using the AdvancedRandom.Weighted expression to generate a value from the desired table:

    dropbox.com/s/uyyh6ysseszs9qq/Advanced%20Random.c3p

    It would be nicer to be able to call the table directly from the expression itself e.g. AdvancedRandom.Weighted("Table1").

    I believe you can have multiple entries on the table with the same name, hence the requirement to state the weighting. Why you would want duplicates I'm not sure - perhaps because you can't change a weighting for an entry once it's been added?

    It would also be nice to be able to import a table from json rather than having to set all the entries as actions.