santiagoestrade's Forum Posts

  • dop2000

    Thanks very much for the explanation. It totally makes sense now. With no indenting, I was destroying at the very time of creating.

    So, may I ask, according to your experience, which way would be less likely to create incoherences for the future?

    I have tried both ways you told me and after adding all the rest of the events, they behave correctly. So I don't know which road to take.

    I am not using any IID for picking, so destroying the first instance does not make any difference, as the game runs as it should. But I might need to add some more loops to the sheet and still worried about how transitioning from and towards the layout would affect. I think this is due to my little understanding of loops and sub-events. That destroying event in the way you showed should be always the first thing to happen, no matter the rest of the event sheet, ain't it?

    On the other hand, something on my mind keeps telling me that having the 'ghost' sprite on the unused layout could affect the sprite.count at some point, when adding more events that use that trigger (have already a boolean variable instance and a pick by comparison for that). I have lots of conditions like "when every instance is locked", "when there are no available instances left", "when every instance is on their variable position", ... some 'for each' loops,...

    I'm trying to find on the web whether the triggers, loops, picks and counts takes into account every layout or not, with no result so far. Layers are mentioned everywhere, yet not layouts. Now reading about layouts to find out. Anyway, I guess by your words that it only checks active layout. So I would be worrying about nothing.

    If only taken active layout, it seems a rather stable solution, since being static and not rendered, as opposed to having some rendered instances on start, which must be removed through an event storing/deleting data into memory, managing logic and checking triggers. But I could be wrong.

    I am afraid to go on working in some fashion and then after a time realizing that will have to write back the entire event sheet because of the approach I had chosen was not right.

    So, as a practical advise for a newbie- sprite on assets layout or destroying on start ???

  • Here is a pretty basic example. Just a tilemap and a sprite. No addons nor behaviours.

    1drv.ms/u/s!AojCIgmN1VlPiT9oKnbUiHXCBSpG

    The issue comes when creating objects.

    In the event sheet, I just have so far:

    On start of layout >

    Repeat 5 times >

    - create troop

    Now, the problem:

    - If there is at least 1 sprite instance, tilemap shows up and those other 5 sprite instances get created.

    -If there is no other sprite instance, tilemap doesn't show up at all and no object/instance is created.

    -If there is no sprite instance and neither the system object creating event, tilemap shows up (with no other sprites, for I didn't inserted on layout nor created through events).

    Possible workarounds:

    - I have to recalculate every pick and count with a -1 or +1 depending on which evaluations/comparisons are needed for the events to trigger and later on it causes several issues when adding subsequent events. Moreover, in order to make it behave as the rest, some events at first are needed to position that first instance in the way the rest are on being created, set angle,...

    - If I add an event to destroy that very first instance, it seems even not to create the other instances.

    - Disabling that only event (creating objects) makes tilemap shows as it should, even if the troop instance was deleted and no sprite instances are left onto the layout. But I need to have those sprites on screen, so it oblies me to insert in advanced every instance that will appear on game and keep changing visibility/opacity all the time, etc...

    Main concern:

    There is some relation between tilemaps and creating instances on layout I don't get.

    As much as I read, can't find the point I'm missing.

    Why would the existence of an instance onto the layout screen interfere with an event whose condition doesn't involve that object?

    Even worse- Why would the existence of an instance (sprite) on the layout screen interfere with the visibility of another object (tilemap) in a different layer, with no event relating them?

  • dop2000

    Here is a pretty basic example. Just a tilemap and a sprite. No addons nor behaviours.

    1drv.ms/u/s!AojCIgmN1VlPiT9oKnbUiHXCBSpG

    The issue comes when creating objects.

    In the event sheet, I just have so far:

    On start of layout >

    Repeat 5 times >

    - create troop

    Now, the problem:

    - If there is at least 1 sprite instance on layout, tilemap shows up and those other 5 sprite instances get created.

    -If there is no other sprite instance on layout, tilemap doesn't show up at all and no object/instance is created.

    -If there is no sprite instance on layout and neither the system object creating event in the event sheet (or having it disabled), tilemap shows up (with no other sprites, for I didn't inserted on layout nor created through events).

    Possible workarounds:

    - I have to recalculate every pick and count with a -1 or +1 depending on which evaluations/comparisons are needed for the events to trigger and later on it causes several issues when adding subsequent events. Also adding some event at first to reposition that first ibstance in the way the rest are, set its same sngle, etc...

    - If I add an event to destroy that very first instance, it seems even not to create the other instances.

    - Disabling that only event (creating objects) makes tilemap shows as it should, even if the troop instance was deleted and no sprite instances are left onto the layout. But I need to have those sprites on screen, so it oblies me to insert in advanced every instance that will appear on game and keep changing visibility/opacity all the time, etc...

    Main concern:

    There is some relation between tilemaps and creating instances on layout I don't get.

    As much as I read, can't find the point I'm missing.

    Why would the existence of an instance onto the layout screen interfere with an event whose condition doesn't involve that object?

    Even worse- Why would the existence of an instance (sprite) on the layout screen interfere with the visibility of another object (tilemap) in a different layer, with no event relating them?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Basically, the statement above. I am testing with several capx (from me and from many examples on tutorials and posts) and it always happens the same.

    When having a Tilemap, it shows up correctly on the layout. But at preview, if no other sprite instance is inserted on the project (not at runtime), tilemap never shows up.

    This is an example of mine, but you can try with any project woth a tilemap and some sprite.

    1drv.ms/u/s!AojCIgmN1VlPiXHgVYT1aGqqT9-6

    If you delete the troop, arrow and line which are outside the viewport and then prev, screen is blank (black, actually :p). Were any of them onto the layout, tilemap shows up as it should.

    Maybe I am missing some point on how tilemap works? Or some parameter I didn't notice had to be set up on the properties bar?

    I know it could be worked around by adding a destroy action into the first event, since I do know they all have IID 0, due to being the first ones created. But it's a bit odd.

  • dop2000

    Sorry, I didn't notice I was posting on the wrong place. I'll ask there.

    The plugin is from chadorireborn. Some other pal told me about it when asking about plugin compatibility and linked.

    It's a public post from him/her, offering some addon ports to the community for free, so I guess- feel free to welcome MoveTo again!

    construct.net/en/forum/construct-3/plugin-sdk-10/construct-3-runtime-a-few-cons-137539

  • I have tried to seek for the topic but it seems no one worries about it. Looks like I am the only one struggling to work with C3 on my smartphone.

    It would be useful to be able to drag events by touch on the event sheet, as for the mouse on PC. Or just adding some extra options to the contextual menu, like 'indent event' and 'push above / push below'.

    Working with a smartphone, I can't indent an event or push it above or beneath. So it's all a matter of cutting/pasting once and once again. It slows down the proccess.

  • Basically, the statement above. I am testing with several capx (from me and from many examples on tutorials and posts) and it always happens the same.

    When having a Tilemap, it shows up correctly on the layout. But at preview, if no other sprite instance is inserted on the project (not at runtime), tilemap never shows up.

    This is an example of mine, but you can try with any project woth a tilemap and some sprite.

    1drv.ms/u/s!AojCIgmN1VlPiXHgVYT1aGqqT9-6

    If you delete the troop, arrow and line which are outside the viewport and then prev, screen is blank (black, actually :p). Were any of them onto the layout, tilemap shows up as it should.

    Maybe I am missing some point on how tilemap works? Or some parameter I didn't notice had to be set up on the properties bar?

    I know it could be worked around by adding a destroy action into the first event, since I do know they all have IID 0, due to being the first ones created. But it's a bit odd.

  • tarek2

    I solved the double tap issue!!! It was just a matter of adding an AND condition when touching the tilemap, so that it only repositions arrow if recognizes tilemap being touched, but not arrow. So if I touch onto an 'empty' tile, arrow goes there, because it was not touched at the same time. But at double tapping the arrow for locking the target, the condition of the arrow being touched forbid the tilemap-event to trigger, because it only runs when the arrow not being touched.

    - TAP TILE TO POSITION ARROW:

    + Touch: On touched Tilemap

    + Touch: [X] Is touching Arrow

    -> ArrowLine: Set position to (Tilemap.SnapX (Touch.X), Tilemap.SnapY (Touch.Y))

    -> ArrowLine: Set angle toward (Tilemap.SnapX (Troop.X), Tilemap.SnapY (Troop.Y))

    -> ArrowLine: Set width to distance(Self.X, Self.Y, Tilemap.SnapX (Troop.X), Tilemap.SnapY (Troop.Y))

    -> Arrow: Set angle to ArrowLine.Angle + 180 degrees

    -> Arrow: Set position to (Tilemap.SnapX (Touch.X), Tilemap.SnapY (Touch.Y))

    - DOUBLE TAP ARROW TO LOCK TARGET:

    + Touch: On double-tap gesture on Arrow

    -> Troop: Set TargetX to Arrow.X

    -> Troop: Set TargetY to Arrow.Y

    -> Troop: Set TargetLocked to True

    -> System: Set ActiveTroopUID to 0

    1drv.ms/u/s!AojCIgmN1VlPiWjfQMhXp4MCGcdS

  • Great man!!! I really really appreciate it. Finally I do understand the logic of managing instances.

    That make sense now. I was adding tons of non-additional worth events hindering the whole behaviour of the sheet. Triggers where weren't needed and system everyticks for triggers-to-be. That explains inconsistent results.

    I think for the moment I'll stick to the global variable for checking the active troop/arrow. Being a rookie, I am afraid won't be sure that after 'deactivating' each troop, no instance will be left with its variable set to inactive. With the global I ensure there's always just one active. But I know what you mean. Once I get used to picking, triggering and indenting in the right way, I'll manage variables individually to clear all. And definitively will need to make some of them functions. Sure I will have to call them at some other point for wahetever reason.

    You're right. Too new at this and trying to solve every bit at once. I'll deal with them one by one. And next time will be posting quoting the proper posts/tutorial with just the point I don't get (and after working with some related capx, I didn't realize how helping is to actually see the event sheet; I now understand why you advised to explain my issue step by step, for sake of logic).

  • I indeed have read about containers, but got it the wrong way. By saying take one object, create a container and then add more objects, I thought it was kinda sub-events, one being parent, so my (wrong) underdtanding was:

    -if I destroy troop (parent), arrow gets destroyed

    -if I destroy arrow (child), troop stays.

    So nothing about it. Just behaving as a regular group. Lesson learned!

    The issue about "calling" arrows is a matter of idiom. I meant that I could pick an arrow based on its troop IID and viceversa. They should be supposed to have the same IID. So if I have global variable ActiveTroop set to Troop.IID on touching that troop, picking its arrow would be pick nTH (ActiveTroop). It may serve for picking both troops and arrows without adding another variable, let's say ActiveArrow. Just thinking in advanced for future functions. Or some way of doing the arrow drag&drop method.

    When I talked about creating, I was stating the case in which I didn't add instances on the layout, yet creating them with events on runtime. To make sure their arrows are created in the same order and share IID. In my capx, there are two troops but only one arrow, so the other arrow has to be created 'by the container'.

  • tarek2

    Not necessary at all the double tap trigger. I wanted a three step method in case you wanted to change your mind once you had touched on target tile. So after touching target tile and "deciding it's ok" you 'do something' to lock the target. Because each troop is not going to move at the time target is chosen. You go picking troops one by one and targeting. Then, at the end of turn, every troop moves. Also in case you decide to choose another troop once you have already touched onto a target tile.

    But double tapping could be sustituted by any other trigger. I was thinking a slightly more elegant solution. Placing the arrow invisible behind the troop. Allowing to drag the arrow with BoundedDrag&Drop. So touching on troop activates it (the arrow actually). Dragging sets the target. And then touching on arrow locks the target. But it's been even worse for me to implement since I have such little kbowledge of events.

  • Oh I see now. At some point my timeline got blurred. It seems I had updated everything according to your tips and some time past answered you, so completely missed my point.

    Anyway, now it's a dofferent matter, thought related in some way. If you look at my capx now, it behaves almost as it should. Except for the arrow not changing visibility as I expect. Creating and destroying them each time would solve that. But in that case, using IID would not reference always to the same instance, ain't it? I have read that it reorders with the instances leftm But in another topic, someone mentioned somrtjing about runtime having 'memory' for the instances previously created/destroyed so it doesn't have to write/load all again.

    I mean- I have two troop sprites with an arrow for each into a container. I call troop and arrow by IID. When touching troop, creates arrow, when moved to arrow, ot gets destroyed. Next time that arrow gets created, gets assigned again the previous IID, due to being related to the troop IID through the container, or simply stacks as the last IID?

    I am trying to figure out the best way to work with them in the future. I know will have to create functions and would be nice to plan how will I be calling then and the objects. Still reading about the topic to avoid bothering you guys so much.

  • I am finding some issues that I can't work around, at least the way I would like.

    The main issue keeps being arrow visibility. At touching troop, arrow shows up and though a set invisible action is set up, it doesn't disappear.

    I am already struggling to arrange events and picks in order to 'erase' the previous not-locked arrow if touched on another troop.

    The other issue is about the arrow not fading out at all. I've tried with at collision troopVSarrow, on troop at targetX, targetY, on troop at ArrowX, Arrow.Y, on troop overlapping arrow, on troop moveto stop, on arrowline width=0... Arrow always visible.

    Maybe I am looking at the wrong direction. Should I create/destroy arrows and lines instead of setting opacity or visibility?

    Double tap is definitively a problem. The first touch repositions the arrow if not touched on the exact point, because it recognizes the tilemap being also touched. So it is always a tap on arrow/tilemap followed by another tap on arrow/tilemap. Is there a way of making the tilemap "untouchable"? Being that the case, I can allow to touch the arrow to lock the target without touching the tilemap and triggering the reposition.

    And a last strange point- I have two troop sprites, each one on layer2. They both have arrows, but just one is 'drawn' onto the layout, on layer1. The other one gets created automatically, because of being into a container with the troop sprite. The troop instance whose arrow&line are already on the layout visually overlaps them while moving, as it should be, since they are onto a lower layer. But the troop which creates arrow&line automatically due to container gets behind them, even being onto an upper layer. There is no way of having them behind without pre-inserting them onto the layout? I have checked in case system was creating the 'containered' sprite on layer0 and even manually set to layer2. But it behaves exactly the same.

  • tarek2

    Ok I'll try to understand every piece of advise you gave me.

    The thing about picking I knew was a flaw of mine. But I am not using nTH (which I suppose it's the one that takes the IID, referenced just for their sprite, so being into a container and created at the same time as their parent object, should always have the same IID, if I understood what you meant), but pick by evaluate variable, so I check the global variable Active troop. I tried with the sprite pick by UID by for whatever reason it always picked both instances or none. Now it is picking the right one.

    I tried even with your capx, replacing the picking nTH to 'pick by evaluate' and works with UID as it does with IID + 'pick by nTH'. Tried also with system compare variable and also picks the right one. The point is I think not to understand correctly the benefits of picking by IID instead of UID. Talking about containers- according to what I have read, on a sprite created, each other attached sprite in his container is also created. So they are always created in the same order. So they should have the same IID. Don't they? In my case, first troop has IID 0 and his arrow IID 0 (first instance of his object) too. As second troop is created, it gets assigned IID 1 and his arrow is created also with IID 1 (second instance of his object). That way is simpler to relate them. Did I understand correctly?

    Right now, with system compare by evaluate picking condition each troop is moving towards its own arrow. I added a boolean instance variable TargetLocked which sets up at double tapping tilemap/arrow, thus confirming target. Then, when skipping turn, an AND condition picking instances with TargetLocked true.

    Indenting all the arrow and target as a sub-event I did as well and everything seems fine with that. The point is that at tapping the troop instance, arrow shows up, when it should have been set invisible. That is an event-order issue I suppose. Will work on that.

    My main problem now is When I tap a different instance, the arrow of the previous ibstance I had activated before, still keeps visible.

    I see what you mean with the every tick on the arrow line. As you say, I am no as used to event arranging. So my guess is condition should be 'Troop is moving'.

    Even the thing about not being able to double tap!!! I know what you mean. By indenting the event, I ensure each double tap 'belongs' only to their picked troop instance. But the point is that if I have Touch.Tap as a condition on the parent event, it is no longer showing up to be selected as a condition for the sub-event.

    C3 simply doesn't allow to say:

    -parent condition: tap on instance

    - sub-event condition: double tap on arrow/tilemap

    I am not sure if I understand correctly what you are explaining about triggers. Could it mean that 'double tap on tilemap/arrow' can't be conditioned as a sub-event of 'tap on troop' because they are both triggers, so runtime would expect to happen at the same time? That would explain why the first touch of the 'double tap on tilemap/arrow always triggers the 'tap on troop event'. So... if changing the sub-event condition to 'is touching tilemap/arrow' wouldn't make it succed either, as I have experienced.

    Maybe the link for my capx didn't updated when I was working on it last night.

    Here is again:

    1drv.ms/u/s!AojCIgmN1VlPiWjfQMhXp4MCGcdS

    Thanks again for taking the time to help. I know it's a basic issue, but coming from a non IT background, reading the forum, tutorials on scirra and the manual don't happen to clear my mind. And any pointing in the right direction is most appreciated. I'll play around with your capx to see if I can understand.

  • dop2000

    I am failing to apply this to my project. At the moment I have more than one instance, I managed to make each one sets up their own arrow to their own target. Yet they both eventually move to the same position- left upper corner. Not referencing each one their own target instance variable Troop.TargetX, Troop.TargetY (though I also tried MovedTo their arrow object due to container, or so I intended, and the outcome was even worse, they didn't moved at all).

    I have messed with sub-events, trying to understand the difference between system 'pick instance by evaluate' and sprite 'pick by unique UID' conditions. I have chosen the system pick condition because of a so-believed repeated object incompatibility when making sub-events that I'll further explain below.

    Another issue comes when I try to make a sub-event from the same object of the parent condition. I'll explain:

    I want to touch a troop instance. And then, only if I touch onto a tile (and only if I touch on a tile after having touched/activated a troop instance), arrow shows up.

    If I don't touch onto any tile and instead I tap any other instance, it should just change global variable active troop to that instance, thus becoming available for targeting a tile with the arrow showing up)

    Would I have touched a tile and the arrow showed up, I could already tap on another troop, so that previous arrow sets invisible and the one from the new-tapped troop sets visible (not at that very moment, but when I later touch on a tile). Well, that arrow never disappears...

    The point is that if I have a 'On Tile tapped' condition, at the moment I try to make a sub-event (for locking just the selected tile) with 'on tilemap double tappef', it just isn't there as an available condition. It only allows to check if it's in touch at the moment, which simply can't meet my purpose. I suspect I am not getting the point of how events order work (yeah... I have read the manual).

    So I have to move the On double tap condition to a new event below, and then can't lock the instance I am working with at that time. It's hardly possible to accurately reach with the finger the point where the arrow is, specially since is blinking and seems not to be touchable when not visible. I tried making it a simple double tap onto the screen, but at the first tap, it recognizes it as a tap trigger and sets the arrow to the point where I touch. How can I work around this? Is it possible to double tap without C3 taking into account the first tap? Is it due to having another tap condition? I'm a bit lost on this, for would bet if I where able to make the double tap a sub-event of the tap event, it would wolve the problem. No reason behind, indeed. Just a hunch.

    I don't know whether may be necessary to include some sort of loop, like 'for' or 'for each'. Or I might be arranging events and sub'events in the wrong way. Or not understanding picking instances at all. I tried also to add an else condition to set invisible every arrow which is not locked yet, but didn't succeed either. Or backing off to the instance variable active|inactive and comparing values.

    Moreover, I have set the set arrow visible/invisible action when I tap a tile. But it shows up when I tap the troop. Maybe because of the container.

    I am a complete mess rith now. Have rewriten once and once again the event sheet shifting between conditions, actions and variables and still being unable to join everything altogether.

    1drv.ms/u/s!AojCIgmN1VlPiWjfQMhXp4MCGcdS