tarek2's Forum Posts

  • One of the reasons I dont use Groups to do the (Active & Deactivate) feature is because when you have many groups it becomes annoying to have to loop and deactivate them before leaving the layout so you can find them in their original state the next time you come back to that layout. That is why I switch to instance variables in an object instead as this will reset their state every time I come back to the layout.

    I like the idea that proposes Alaistar:

    The availability of making (Local and Global) event sheets or Groups. I have wanted that since I used Construct.

    It is like the Local variables they are very useful for temporary values and once you leave the scope it resets to default values.

  • I'm trying to make it so that the player can't wear both the same clothes and the other at the same

    I can put on both hunter pants and gorka pants at the same time,

    Sorry is not really clear what you are trying to achieve as both statements contradict each other and are confusing:

    But looking at your pictures and your old events, it looks like you have problems swapping long pants that you find on the ground, is that right?

    Example:

    On "F" Pressed & is overlapping pants on the ground -----> Wear it?

    If so, what happens if you already wear pants already?

    On "Q" Pressed & If is Wearing pants -----> Drop it?

  • It seems that you are splitting the events unnecessary and it could be hard to track.

    Why not do everything under the trigger on mouse touch?

    For example:

    On (Touch or Mouse) touch reload button

    ----Sub Event: Clear dictionary

    ------------------- Function Call get sys info

    ----Sub Event: Dictionary "For each key" ---> Add to text ----> newline & ----dictionary.CurrentKey & ";" & dictionary.CurrentValue

    ----Sub Event: Append Newline & "PRESET" & Newline & text & & newline & "END"

    Not sure if it's clear enough the structure as it removes the empty spaces but there are 3 sub Events independent from each other, they should be one after the other

  • ah yes i was under the impression that tag at would be give me the key itself as i couldnt find any other reference. except that of get which is used to get the value

    the format i wsa looking for is "key (the thing it is) adn value (the actuall vlue of the reference to the plugin)

    and im not even sure what tag at does but it appeares in the dropdown when you select which function to use

    Isee

    In that case you should use:

    Add to text ----> newline & dictionary.CurrentKey & ";" & dictionary.CurrentValue

    This will add on each line:

    Current key;Current Value

  • Maybe try:

    On F Pressed:

    Gorka_Pants "is Not Equal" = 1

    ----- Set Gorka_Pants = 1

    ----- Destroy Gorka_Ground

    ----- Spawn Gorka_Pants

    ----- etc...

    On Q Pressed:

    Gorka_Pants "is Not Equal" = 0

    ----- Set Gorka_Pants = 0

    ----- Destroy Gorka_Pants

    ----- Spawn Gorka_Ground

    ----- etc...

    Another thing is make sure you use the trigger "on Key pressed" instead of "On Key is Down" because on key is down keeps running while the key is down, so can run multiple times.

    And on Key pressed trigger just runs once

  • Not sure yet everything that you are trying to accomplish here but here are a few issues that I see:

    1-Your Dictionary event ------> "For Each Key" ---> add to Global Text

    is running every tick so is constantly adding values to your global variable.

    If this is not what you intended, consider putting that event in a trigger like for example under "On start of layout" that you have above that, so it runs only once.

    2-On your dictionary you are using----> Dictionary.TagAt()

    what is that TagAt() mean??

    I have never seen it in my life, even the C3 Manual doesn't mention that :))

    Could be a new thing?

    Though in any case to get the dictionary values you need to use:

    Dictionary.Get("Your Key Name")

    For example:

    Dictionary.Get("Canvas CSS height")

    Dictionary.Get("canvas CSS width")

    Dictionary.Get("Downlink")

    etc...

    If you try to get the dictionary Values in a "For Each Key" you can even use

    Dictionary.Get(Dictionary.CurKey)

    CurKey = Current key

    But that expression only works when you use "For Each Key"

    3-To add new lines of text, normally you do --------> newline & "Your text"

  • Just a quick thing to check:

    Most probably you are already doing it, but a lot of developers that have problems with saving and loading (System Save or Local Storage) are because they dont wait until the save is complete as it takes more than a tick to do the job. Have a look and make sure you wait until the save is complete. You can use the "Wait for the previous Actions" or the triggers that C3 offers.

    If you dont wait properly, that could explain why sometimes it saves properly and some not.

    -As when it saves correctly maybe it is because the save happens quickly

    -But when it doesn't save correctly it is because needs more time to save and if you dont wait it will mess up the save.

    Example:

    -You use the Actions SystemSave

    -The next action is to move to a different layout

    Note:

    The same thing is true for loading saves, you need to make sure it waits until the save is loaded

  • tarek2 I thought about this system, but the game I'm creating is too big, and I would have to set a lot of settings for "team2"

    This has its own challenges, I dont recommend you go that route as it can cause you a lot unnecessary problems, because when you compare (Family Vs Family1) you gonna pick yourself so you will need a lot of filtering to exclude yourself from the Picking list, either for LOS checks or for any other events that you will need to compare (Family Vs Family1)

    But if you think you can handle then go for it and try it. This is normally for advanced users, who will know how to debug and resolve things.

    In this picture, can I replace something from (for each) to something lighter? When there are more than 20 objects in the game using this configuration in the image below, the FPS drops a lot.

    When I removed the "for each" for testing, even with 200 objects my game continued at 60 fps

    The "For each" is needed as the event has to run per instance to check if it has LOS to enemies and then Pick the nearest.

    Remember the example I gave you is just for demonstration of how to resolve the first issue you had about picking a turret target without adding the whole family as a target as you lose the filtering by teams, therefore you put the whole family as a target.

    Since there are only a few objects for demonstrations in my example I dont need to do any extra filtering or performance tricks. But in your case, if you gonna have 200+ enemies you gonna have to adapt the events according to your game. This has to be done on your side as only you know what you have in the game.

    The most common issues with the performance you can resolve them by (Filtering more the Picking & dont Run the events every tick)

    Example:

    Every 0.5 seconds

    Family1 is on Screen:

    ---------->Family1 has LOS to Family2

    ------------>Etc...

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/events/how-events-work

    I honestly never use the Turret as you can replicate it easily with the LOS behaviour and you have the freedom to filter and pick whichever you need.

    For example:

    Remove the Turret and you can do something like this

    Then:

    You just have to add some events to make sure you rotate towards Family 2.

  • tarek2 I actually asked a bit confused hahaha, I meant that instead of adding each shooter to attack, add the "shooter_team" family to attack the "shooter team" family If they are not on the same team

    It took me quite a long to understand what you are trying to do but I think I finally got it, or I hope so:

    So you are adding new object types to the project and you want to run one code base for all the objects through a family to avoid duplicating the same code for each object type?

    To do that and to simply the picking for yourself is to create two families instead of 1. Add the variable "Team" to both families, but since an object cannot have repeated variables call them "Team1" & "Team2" but keep in mind that is the same variable.

    Create:

    Family1 -------- and Add variable "Team1"

    Family2 -------- and Add variable "Team2"

    For every object that you add to the project, you need to include them in both families. And set their Team.

    For example, you add to the project "Shooter_3"

    Add "Shooter_3" ----------------- > to (Family1 & Family2)

    And Set "Shooter_3" Team variables to the exact same team name:

    For example, it is for (Team = 1)

    Set variable "Team1" = 1

    Set variable "Team2" = 1

    Another thing is, remember to do the same when you spawn any new instance, set both variables:

    Set variable "Team1" = YourTeam

    Set variable "Team2" = YourTeam

    https://www.dropbox.com/scl/fi/hybo21shepp9oytl26rvv/Turret-Dont-target-friends2.capx?rlkey=b16nywwasp80yaje3eiqsahx3&dl=0

  • tarek2 Do you know if I can add the family itself to attack if it is not the same one I had at once? Instead of having to add each LineOfSight shooter.

    Hi

    I dont quite understand what the question is or what you are trying to do:

    In construct, you cannot change families!

    Or are you referring to teams?

    If you are referring to teams, then if you just change the team it will automatically attack any other team that is not from his team.

    Also, make sure you spend time trying to understand how the behaviours work, to have an understanding of the capabilities and limitations you will face, and then with the help of the examples that they provide you, you can learn how to circumvent any Limitations so you can make your own logic to tackle anything you wish to create.

    I didn't find the Construct2 manual but the C3 is still relevant at least for the common features that both share, excluding any new features that have been added to c3.

    https://www.construct.net/en/make-games/manuals/construct-3/behavior-reference/turret?utm_campaign=C3Editor&utm_source=browser&utm_medium=r391&utm_term=OpenManualLink&utm_content=BehaviorHelp

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But tarek2, In this case I would like that, when I touch the tile map It creates the object where I touched within the tilemap

    I see, check this example:

    https://www.dropbox.com/scl/fi/1pg1fes8utqsxtzupvy9i/Spawn-Objects-on-Neighbor-Tiles4.capx?rlkey=2u8ehfkbra39350x8g625gnsj&dl=0

  • Dude you are amazing! Thanks again, but how do I make it so that when creating the object, it changes the tile, and when it is destroyed, it sets the available tile again?

    Np glad it was helpful

    but how do I make it so that when creating the object, it changes the tile

    Look at the start of the layout it sets the first objects tiles as occupied, like this:

    and when it is destroyed, it sets the available tile again?

    The same process but you set the tile to 0

    If you have multiple different object types then put them in a family and just reference the family instead.

  • That health bar is more suited for objects that will not change their angle. This is because the bar is not pinned exactly in the XY of the object so it will mess up the bar.

    Here is a health bar that will work with rotated objects in C2:

    https://www.dropbox.com/scl/fi/845uqm6zery8nkxl7awov/2-Health-Bar-That-Works-with-Family.capx?rlkey=k80bblsn2xjeyybkoym9rxxuc&dl=0

  • You can do it in many ways:

    Example:

    1-By Tiles, setting them as occupied after you spawn a cannon on them. For this, you can use normal Sprite tiles or Tilemaps Tiles.

    2-By Arrays, you can mark the cells that the cannon is in as occupied by setting the XY to 1

    etc...

    Here is one way by using the Tilemaps method:

    https://www.dropbox.com/scl/fi/wgenu56j26m4xypy6bty2/Spawn-Objects-on-Neighbor-Tiles.capx?rlkey=p4qg99f2ef9a2xh5qsoprjaen&dl=0

    Note:

    This always follows the same pattern, checks first at his right and then does a clockwise 360-degree check for all the other tiles.

    ======================================================

    If you want them to spawn at Random Tile then you need to change a bit the code.

    Here is one example:

    https://www.dropbox.com/scl/fi/40t4wvg3ktnbbz2a18h5a/Spawn-Objects-on-Neighbor-Tiles2.capx?rlkey=etdkbql8xjwhw449e1qga6xhb&dl=0

  • Great suggestion!

    It definitely got worse at least from the iOS side. Every iOS update there are several issues. And also they dont even replay the bugs as you found out in your last bug report about the canvas shift down that we reported long ago. This led me to postpone the iOS release for quite some time till it's fixed. It becomes very unreliable.

    Another idea if they dont want to get away from Cordova, is why not support one more platform from the ones that you pointed out so we can test it and then if it works better then you can always remove the Cordova platform in the future. This at least will give a few alternatives.

    Scirra always say resources are tight so not sure if this ever gonna happen.