tarek2's Forum Posts

  • Hello, I didn't mean event sheet name duplicate, but event sheet inclusion duplication, for example (using your screenshot) have event sheet 1 included twice in event sheet 2

    Hi

    Yes, I was referring to the same thing, I couldn't reproduce your issue of duplicating the same "Include Event Sheet" twice in the same event sheet.

    But I found another issue:

    For example

    If you right-click on "Event-Sheet1" and choose "Include Eventsheet", it will not show you "Event-Sheet1" on the list to choose from, this works well as expected because events sheets cannot include themselves.

    But if you are on "Event-Sheet2" and have included "Event-Sheet1", if you copy that include by (CTRL + C) then go back to "Event-Sheet1" and do (CTRL + V) it will paste the include "Event-Sheet1". Meaning it ends up including itself, as I show in the pictures.

    Look for example at my first picture:

    Im in "Event Sheet 2"

    And look which event sheet has included = "Event Sheet 2"

    Meaning "Event Sheet 2" it included itself

  • That sounds like a bug if you can duplicate the same Event sheet name twice, you should probably report it to Github.

    I couldn't reproduce it myself but while testing I found another possible bug which lets you assign the same Event sheets to themselves.

    For example:

    EventSheet1 ----> By doing (CTRL + C) & (CTRL + V) you can past include "EventSheet1" on the same EventSheet1

    It doesn't allow you to do that in the normal way of picking an event sheet when you use Include Eventsheet, so I suppose is a bug.

  • Use the expressions:

    Touch.X("BG")
    Touch.Y("BG")
    

    To get the current position of a touch in layer Co-ordinates:

    This takes into account the (Parallax, scaling and rotation) for the provided layer, in this case, is the BG Layer.

    This solves your misconfiguration issue as you have "layer 1" with (Parallax = 0)

    You can hard code the Layer-Name but if in the future you change the layer names, or the object layers to a different layer you will always need to update the layer names on all those events that reference them. So in this case, I would target the "objects.layerName" expression to make it easier for you and less work to do in the future. This way you can change layer names or the object's layer placement without the need to worry about constantly updating the events.

    Set WheelPicker Position to:

    Touch.X(WheelFalling.LayerName)
    Touch.Y(WheelFalling.LayerName)
    
    

    Set Color to:

    Functions.pickColor(Touch.X(WheelFalling.LayerName), Touch.Y(WheelFalling.LayerName), WheelCanvas.UID)
    

    Set WheelPickerStatic Position to:

    Touch.X(WheelStatic.LayerName)
    Touch.Y(WheelStatic.LayerName)
    

    Set Color2 to:

    Functions.pickColor(Touch.X(WheelStatic.LayerName), Touch.Y(WheelStatic.LayerName), WheelCanvas2.UID)
    
  • I have license in older version of construct 2 (266). There is only 'Cursor is over object' option when adding a condition :/

    Yes, that's the one, you just have to invert it to make it negative:

    Cursor is over object <------Invert it
    

    If you want to make any condition negative in construct this is what you do:

    1-Right-Mouse click on the condition

    2-It will open a panel and select "Invert"

  • Very difficult to understand the issue just from the picture and the description:

    Consider posting a small c3 example showing the issue, and if possible a few images with (Right & Wrong) this will help anyone trying to help you, and overcome the language barrier.

  • One idea would be:

    On Mouse Clicked on BG
    Mouse cursor is not over Map: ----------> Close
    
  • > You have also the File system "Write Binary"

    How can I add an image to Binary Data?

    You need 3 plugins:

    -Drawing Canvas or (System Snapshot canvas)

    -BinaryData

    -Ajax

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello tarek2 It wouldn't be exactly that

    I would like, for example, that when a bomb explodes near enemies, the bomb's damage decreases the enemies' health. But when I do this, it only decreases the health of one enemy.

    There is not much info, so will be impossible to help:

    You say that you have a circle which you are using as the radius area damage, and when it hits multiple enemies it should subtract from their damage. That should work with any of the options they already provided you.

    Enemy on collision sprites: ------> Sprite Subtract health

    or

    Enemy on overlaps sprites: ------> Sprite Subtract health

    Any of the two should pick all the sprites touching the enemy.

    Not sure where is the issue?

    The example I provide you already shows you that is working with "On Collisions" which picks all the sprites that collide with the enemy.

    You just have to replace the "destroy" action with sprite subtract Health.

    But when I do this, it only decreases the health of one enemy.

    If you are asking why isn't working your example then is impossible for anyone to know as they can't see your project. You gonna have to provide an example showing what is not working, so someone can give you an accurate answer. At the moment we just guessing.

    It sounds like you have a Picking problem but we cannot move farther as we need to see an example to investigate.

  • Is a bit difficult to understand what you mean by area.

    It sounds like you want to reduce damage to the enemy for every sprite that hits him?

    You could use the:

    Enemy on collisions with sprites: ----------> Reduce damage

    https://www.dropbox.com/scl/fi/vm3pja2mymtlulg5vzd9g/Collisions.c3p?rlkey=x1ju8w7snxf101um1wtztswhc&dl=0

    Or do you mean something else?

  • Do you want to keep the turret rotation active?

    If you want to keep the rotation handled by the turret then you will need to change all the Animation frame Angle to face (angle = 0)

    So they all face the same direction, otherwise, it will conflict with the turret rotation.

    Then one idea you could do is to keep the events short and clean:

    Change the Animation names to:

    R = 0

    L = 180

    Up = 270

    Down = 90

    Then you set the turret Animation to:

    str(round(((angle(Self.X, Self.Y, Player.X,Player.Y) + 360) % 360)/90) * 90)
    

    You can also use the every x seconds to change the animations, maybe something small Every 0.3 or something like that.

  • I think this issue would be best if you could open a bug report so the C3 team can help you:

    https://github.com/Scirra/Construct-bugs

    They will investigate it and check your (device and browser) details plus any errors to see if there is any fix.

  • You have also the File system "Write Binary"

  • Do you mean on the web?

    You can use the Browser plugging "Invoke Download"

    Exporting to Nwjs etc..?

    You can use "Write Binary" in the Nwjs plugin

  • You need to share a small example so someone can investigate it and help you as it's not clear what is happening here.

    In general (Bound to Layout or Dragg) it shouldn't interfere to destroy an object as long both are overlapping.

    It's hard to say without looking at an example.

  • MessMess

    Families were created to solve many problems, like Picking and treating many different objects as a single object to simplify the code and the Picking and the number of events that you would normally need.

    In your case, it's a perfectly valid solution and simple, as that is what it was designed for, you just need to follow the advice that was given which is to put the objects in a separate Family that you will just use for clickable objects so you shouldn't have any problem if you followed the advice.

    4-You could put them in a family and filter them

    Put all your click-able objects into a family, then you can setup your events like:

    More info about Families:

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/objects/families?utm_campaign=C3Editor&utm_source=browser&utm_medium=r391&utm_term=OpenManualLink&utm_content=ProjectBar-FamiliesHelp

    There are no restrictions on how many families you can create in the c3 paid version.

    Are there more solutions?

    Yes

    Do you have to use families?

    Not necessary, you can use the method you like the most and which it resolves your issue in the most simplistic and logical manner. So Families is just one of them. There are other solutions without families.

    It would be an instance variable at the family level, also called a family instance variable, so on the family object Towers you can add an instance variable 'stamped' for example. Then in a general event (order doesn't matter), you can add 'on mouse click release' and 'Towers.stamped=0', set Towers.stamped to 1 (0 is default).

    Another way to do the same functionality without using mouse click is to have an event 'Family Towers on created' - wait 0.1 seconds, set Towers.stamped to 1.

    Then returning to your original event for rotating, you add a condition 'Towers.stamped=1', means it won't be rotated at the same time it is created but on second click it is possible. You can then remove the black square from the family also.

    None of your solutions solved the problems he had lol

    Honestly, they dont make any sense if you look from the perspective of the context that he needs to solve. ))

    The Issues he was trying to solve:

    He has two totally different and independent events:

    1-If you click any obstacle that has no tower --------> Spawn a Turn object which I assume is a (Tower)

    2-If you click in a Tower --------> Rotate the tower 90 degrees clockwise (Probably to fire enemies at different angles)

    It would be an instance variable at the family level, also called a family instance variable, so on the family object Towers you can add an instance variable 'stamped' for example. Then in a general event (order doesn't matter), you can add 'on mouse click release' and 'Towers.stamped=0', set Towers.stamped to 1 (0 is default).

    There are many issues with this solution:

    -You dont pick correctly the target "Tower" which you need to use the "On Mouse Click On Tower" to know to who you need to apply the action Rotate, so your events are not clear as to which Towers are applying the Rotations. Because without Clicking the Tower you can never know to which tower you need to rotate.

    -"On Mouse Release"

    Is gonna fire the Rotate Events and conditions checks each time a "Mouse-Click" is released.

    He doesn't need that as he wants instead to just rotate the Tower explicitly when you touch it, not every time you release the Mouse click.

    Another way to do the same functionality without using mouse click is to have an event 'Family Towers on created' - wait 0.1 seconds, set Towers.stamped to 1.

    The same issue:

    -The Picking is wrong as it doesn't need to rotate the objects that are created, just the ones you select with "On Mouse Click On Tower"

    therefore there is no way to change this condition so you have to use "On Mouse Click On Tower" and you have to make sure that both triggers (Towers & Obstacle) dont trigger at the same time.

    Then returning to your original event for rotating, you add a condition 'Towers.stamped=1', means it won't be rotated at the same time it is created but on second click it is possible. You can then remove the black square from the family also.

    -This is just personal but:

    I would recommend you always run your events under a Trigger whenever you have the opportunity, which in this case we have under "On Mouse Click On Tower"

    [b]-"On Mouse Click On Tower": [/b]
    Will only trigger on user input and it will run the events only once
    
    [b]-'Towers.stamped=1',[/b]
    This checks "every tick" 
    Every Tower if (is = 1) 
    Unnecessary just to rotate when you can do the events under a trigger which will run only "On triggered" and it will run the action to just the clicked tower.
    

    This avoids scenarios such as:

    Imagine you have a big layout with hundreds of Towers, it will:

    Check "every tick"

    Every Tower if (is = 1)

    Wasting resources is unnecessary just to make a simple rotation.

    Benefits of adding the actions under a Trigger:

    -You keep all your actions under just one event which makes it easy to manage instead of having separate events and conditions. Also, it makes it easier to debug when you have a bug as you have everything under one event.

    -Save resources

    -Avoid unnecessary waits, as if you keep adding them in any trivial matter just to solve simple issues such as this which doesn't need any waits you could end up in the future in a big messy code and potential bugs when you try to add new features etc... Which could be hard to track.

    Alternatives Solutions:

    If for any reason you dont want to use families. Remove the obstacle from the family.

    There are many ways you could archive this:

    1-Just add a condition blocker to the obstacle:

    Note:

    Make sure that the Tower is at least 1 pixel smaller than the obstacle to work, otherwise if both are the same size then it will trigger true if it overlaps neighbours Towers on different tiles, so by setting the tower to 1 pixel smaller it avoids false triggers from the neighbours.

    An alternative you could just make the Tower collision box 1 pixel smaller if you need to keep both (obstacle & Tower) the same size.

    2-You could keep track of the obstacles that have a Tower by adding a boolean like for example "Has_Tower"

    -On your event that you spawn the Tower --------> Set Obstacle.Has_Tower = True

    Then these events:

    There are probably many more ways, but in short, don't be scared to use families as they are a very powerful feature in Construct that you will need to do from advanced things to simplify your events etc...