99Instances2Go's Forum Posts

  • LevelArray.Clear() sets every element to zero.

    Pointless to use push after that.

    Or the array had the size (0,1,1), then push will work as expect, but the clear is pointless

    Or the array has elements (10,1,1) then the push will make a 11th X index, clear and push are pointless.

    Instead of clear, set the size to (0,1,1). That is a truly empty array.

    The AsJSON does not contain the graphics. An array with the AsJSON strings is not enough.

    Creating an member from a family creates a random member.

    So, the family needs an instance variable identifying the member.

    That variable needs to be stored in the array too.

    After loading the array, while running trough it

    you will have to create/destroy a family member (in a while loop) until it matches that variable. That is not easy, and can eat time. Then set it to the AsJSON string.

    Or.

    Create the correct sprite (not family) depending on that variable.

    That is just a lot of events, 1 creation event for each possible sprite.

    Compared to that, Newt's solution is a breeze.

  • That is what the LOS does already. (had that covered)

    There is no distance calculation faster and less resource demanding than the LOS.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1. Graphics issue, got to draw in right proportions.

    2. You do not zoom proportional.

    3. A scale factor is a number which scales, or multiplies, some quantity.

    Why point sampling ? Are you making pixel art ?

    Are you scaling each object individually ?

    I am getting the idea that you are doing something totally not standard.

    Gonna humble back off, might be better if you share a .capx.

  • This might help you with figuring out Cell Size and Cell Border.

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

    It draws the cells & the borders. Change the property's for the path finding behavior. Change that one global variable. And run it.

    You might find it surprising to experiment with some values.

    Also, what this little experiment will teach you. The curve of the path is not depending on Cell Size and Cell Border. It depends on the way that it is moving over the path. And the only 2 properties you have at this moment to change the way that it moves is Speed and Rotate speed. Try some combinations.

    So, to stop it from cutting the corners (in tight grids) and have a natural way of moving, we need to take care of the moving our self.

    One of many ways, using a 3th party plugin :

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

  • 'So then if they reach the coordinates for that action'

    Are you comparing positions with 'is equal to' ? That will indeed not work. Watch positions evolve in the debugger.

    Notice the numbers after the decimal point. A position is kinda never exact.

    Rather.

    Bring all those clickable objects into 1 family.

    Bring character and an invisible sprite 'target' into a container. Now each time you pick a character its target is also picked.

    Give 'target' an instance boolean 'actionRequired'.

    Give 'target' an instance variable 'actionObject'.

    Give Character the Lign of sight behavior. Set range to like 50 pixels.

    When the player clicks a new target, move 'target' to that position. Find path to 'target'. At the same time.

    Set 'actionRequired' to true when clicked on clickable object, else to false.

    Set 'actionObject' to the UID of that clickable object.

    The action is directly linked to the clickable object, probably in a variable on the family. We pick that object later.

    Character has reached endpoint when action object is in range.

    Target.'actionRequired' is true ? <-- picks also Character due the container (no performance loss when not true)

    Character has LOS on family <--- Character & Target only stay in the picklist if it has LOS

    Family.UID =? Target.'actionObject' <----- additional logic

    Absolute necessary action: Set Target.'actionRequired' to false, else the whole logic will repeat and repeat until the player chooses a new target.

    At this point the logic true/untrue detects if Character arrived at endpoint and clickable object did not run away. It will also trigger if clickable object moved towards the Character, bringing itself into range.

    At this point the picklist contains clickable object, so you can use its assigned action to perform the action.

    The picklist contains also Character and Target, so you can exclude them from getting clicked with the mouse, else player can send them wandering before the action is done and over with.

  • Well, strip it to the bare bones, and share the .capx.

  • Additional.

    Do not pick by UID the way you do. UID's will change during development.

    Instead use Instance Variables and pick based on them.

    I have also no idea how you get that HUD on screen.

    I dont even know how you make a first row visible, before we talk about a second one.

    Beside that, invisible does not make a sprite 'un-clickable'.

    I really have no idea where to start.

  • It needs to be on it own layer.

    Scale the layer in away that its scale factor = 1 when the the others are zoomed in to the maximum allowed.

  • First this about that concept 'index'. An index is the place that 'something' has in a list of 'things'. An index is always zero based. (the first 'something' has place zero in the list)

    A tile in a tilemap contains the following info :

    Its state (mirrored , flipped ....)

    The index of its graphic contents. (iD)

    The index of its position on a horizontal row (iX)

    The index of its position on a vertical row (iX)

    Besides that, Tilemap knows the position for the center of that tile (X and Y in pixels)

    Using the Conditions, Actions and Expression for Tilemap can be confusing.

    When using the condition 'Compare tile at' (by example) it is asking to input 'Tile X' and 'Tile Y'.

    As a beginner you would expect to fill in positions (In pixels)

    But when you look at the description then you see that is expecting indexes (iX and iY)

    To walk trough a tilemap we need to set up a nested loop.

    First for the horizontal row of tiles.

    The first tile on a row has index zero.

    The last tile on a row has index round(tilemap.Width / size of 1 tile)

    Then a sub condition for the vertical columns.

    The first tile on a column has index zero.

    The last tile on a row has index round(tilemap.Height/ size of 1 tile)

    Looks like this

    Root Event > System > For > Name = "iX" ... start = zero ... end = round(tilemap.Width / size of 1 tile)

    Sub event > System > For > Name = "iY" ... start = zero ... end = round(tilemap.Height/ size of 1 tile)

    That is the nested loop. The index of the loop we access with the expression loopindex("name")

    So we continue with another sub event.

    Tilemap > Compare tile at > Tile X= Loopindex("iX") ... Tile Y = Loopindex("iY") ... Tile = iD

    But often you need the iX and iY for a tile that is nearest to (lets say) Player.X and Player.Y.

    In that case we have to translate X & Y (positions) to iX & iY (indexes)

    Tilemap can translate those (positions to indexes) with the expressions Tilemap.PositionToTileX & Tilemap.PositionToTileY

    So, to compare a tile near the player :

    Tilemap > Compare tile at > Tile X = Tilemap.PositionToTileX(player.X) ... Tile Y = Tilemap.PositionToTileY(player.Y)

    I think met this info, you have the base to understand the manual about Tilemap, and figure out the rest yourself.

  • hielo777

    Did you know that you can make a exact copy this way ?

    Including position, mirror, angle, size, even calculated paths ... etc ...

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

  • Use a Family.

  • What is the difference ?

  • VelocityX and VelocityY are allready in units pixels/second.

    IF you use the action 'Set stepping mode' to 'Framerate independent'

    And if not, and that is the default setting, it using a fixed fake dt to calculate its speeds.

    I think that is 1/60.

    So then the correction is (Velocity /60) / dt

    Normally the relation between 'pixels/tick' and 'pixels/second' is ...

    'pixels/tick' = 'pixels/second' * dt