tarek2's Forum Posts

  • You could use a Tilemap for this:

    For example:

    Set the Empty tiles to (Tile = 0)

    Set the obstacles to (Tile = 1)

    -On Tile Clicked extract the X&Y into a Local variable

    -Loop in the 4 directions by using the System "For" loop:

    Dir Right ---> For "X" From (TileX +1) To ((Tilemap.Width/TileSize) -1)
    ---------> Tile at(LoopIndex("X"), Y) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Left ---> For "X" From (TileX -1) To (0)
    ---------> Tile at(LoopIndex("X"), Y) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Up---> For "Y" From (TileY -1) To (0)
    ---------> Tile at(X, LoopIndex("Y")) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Down---> For "Y" From (TileY +1) To ((Tilemap.Height/TileSize) -1)
    ---------> Tile at(X, LoopIndex("Y")) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    

    Probably a second condition is needed there to make you stop at the edges so you dont check outside the tilemap.

    Tile is not equal to -1

    Tile is not equal to 1

    If you really need to use sprites then you can still do all the tile checks in the tile map as I showed above and then when you need to change the frames just pick the Sprite tile that is located on that Tile by using Pick by overlapping Point XY

    or

    alternative you can do the same job by using just sprites alone if you add two variables to the sprites:

    Tx

    Ty

    At the start of the layout do a loop to set all the (Tx & Ty) variables and use the same system as the tilemaps. But this time pick tiles by comparations:

    Tile.Tx = X
    Tile.Ty = Y
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another idea using Bullet could be to:

    -Add a second Tilemap just for collisions or an alternative is by using Tiled_BG

    -Add the solid behaviour to it

    -Close the grid area by surrounding the grid with thin lines around the 4 edges of the grid

    -Set the sprite bullet settings "Bounce of solids" to Yes

    -And every (5 or X) seconds set "sprite.Bullet.Angle of motion" to a random(360)

    Example:

    The red lines are the collisions, which is a Tiled_BG with solid behaviour.

    One thing that I see in your video is that the sprite comes from outside the grid so you may want to turn off collisions for the sprite temporarily until is inside the grid then you turn the collision on.

    Both behaviours are good for this type of job.

  • tarek2/Can anyone tell me if the TURRET behavior uses more CPU than (set angle to)

    https://www.construct.net/en/blogs/ashleys-blog-2/answer-own-performance-925?srsltid=AfmBOopvjhaNvz-fuFuHQQO-mJDKroGSJjiLhqdu-AcPrmcb1LxTB7ys

    How can I make it so that a family of enemies, when they see the player, can attack him (and stop moving using the bullet behavior instead of Phathifinding.

    When a Family of enemies sees the player ----> Turn Off one behaviour and Turn On the other?

    For the Attacking:

    There are plenty of examples on the forum, you can just do a quick search if you get stuck.

    Also, there are hundreds of examples on the C3 editor you should be able to find one that meets your requirements.

  • I'd like to clarify my specific needs a bit further:

    I have a single layer containing multiple images and platforms. What I'm trying to achieve is to control all these elements simultaneously, making them move downwards on the Y-axis automatically with each frame. Despite trying various approaches, I haven't been able to find a method that works for this specific setup.

    A few ideas you could do:

    1-Put all the objects in a Family and then just set the "Family.Y" Position to move the objects.

    Or

    You can also add some behaviour to the family like the Bullet and set the speed and let it run automatically.

    2-Another idea will be to create an object and name it for example "Scrolling_BG"

    -Add all the objects from the layer that you need to scroll to a Hierarchy with "Scrolling_BG" and make the "Scrolling_BG" as Parent

    -And set the objects to just Transform the Y on their Hierarchy settings

    -Move your Scrolling_BG.Y manually every tick or add a behaviour like a bullet. This will make scroll all the objects in the hierarchy together with their Parent.

  • Yes, thank you. But in fact, I am already quite demoralized, it is very difficult to find something suitable for C3, and the guides that are available for C2 are not always suitable either.

    for myself, I spent quite a long time:

    https://www.dropbox.com/scl/fi/lmo81e4rngd5i7dh1t41i/MBAZ.c3p?rlkey=yky6u8litck5gf5aaux9s29hv&st=usdovz84&dl=0

    I tried to do everything according to the guide (A series of guides that lasted 2 hours at a time) But when the time came that the item should appear in the inventory, I faced the problem that I could not pick up and put items in my inventory.

    https://www.youtube.com/watch?v=cNxjdxbRpIg&t=1s

    I believe that the point is that the guide suggested making two inventories, one for "Potions" and the other for "Swords". If you don't mind, you can point out my mistakes here

    In fact, I feel much better when I can talk to a person.

    And now, I have finally separated myself, I want my inventory to be visualized.

    Hi

    I definitely dont have the time to check some else projects I'm afraid, this is quite a lengthy task that will take several hours if not days, and it's always an endless back and forward because new questions always arise, which is time that I dont have even for myself.

    I have done my bit, I will leave it for any other user that has the time and that wants to jump in and give you a hand. But keep in mind that all the users work for free and normally the forums help should be for (Quick Questions & Quick Solutions) that do not require too much involvement. So if you dont find any users then this could be one of the reasons to keep in mind.

    If you dont find any users consider paying an hour or so to a Freelancer who can sit with you check your project and give you some coaching while you finish your inventory. And so you can ask questions and any concerns, which I think is the one you need.

  • Sorry my bad, I was trying to call the tween with the tag.. "DashboardUP"

    I see

    Normally, for this type of situation, the only way anyone can help you is by posting a minimal example so they can investigate it and show you what was wrong as it's hard to debug without seeing your project. They will just guess.

    Here are some ideas you can test:

    1-Make sure that the Tween "MoveToCentre" finished is triggering by adding a console log as you did on your second trigger

    2-If the above tween Trigger is working then I will run the project on debug mode and check if that "PlayerBase_Collisions......" Boolean "isBasegrab" is = True

    3-Then If the above two are true, I will run the project on debug mode again and check if the object "PlatformWindow.........." Exist on the current layout

    4-Then If the above three are true, I will check that both Names (Trigger & Tween Action) match "DashboardUP" without any extra spaces

    5-Then If all above are true I will post a small example reproducing the problem

  • One idea will be to keep track manually.

    Here is one example:

    It will Pick and destroy all the black sprites and show who was the last one destroyed.

    dropbox.com/scl/fi/c3tp5wgwqhlmqpgst6fns/Pick-Last-Destroyed1.c3p

  • I can't see on your picture the event for:

    On any tween-finished?

    Are you sure that you are targeting that trigger and not a different one?

  • tarek2It's still a little confusing, I'll try, this is very difficult, I'm trying everything,

    but it's difficult to do this by creating 8 objects and adjusting them to the grid 🙁

    dropbox.com/scl/fi/h2zhtxyg892gccasti18m/Position-a-Grid-of-objects-inside-another-Grid2.capx

  • tarek2 The blue balls are separated, so I'm having trouble creating them, I would like you to create 9 objects and adjust the grid

    I think I already showed you that:

    Honestly, I'm scared to answer any of your questions as each time I resolve an issue there are 3+ more new questions to resolve that weren't part of the question. Im gonna have to take a break from this post.

    I think I already showed you that here:

    https://www.construct.net/en/forum/construct-3/how-do-i-8/hi-guys-help-positioning-183839#forumPost1113792

    What have you tried???

    There are so many options available:

    Use a Tilemap loop through all the tiles and spawn your tiles

    or

    Just loop through each tile of the tiled Background and spawn your objects

    You can sue the "For" loop XY

    For "Y" From 0 to (Base.Height/48)-1:
    ----> For "X" From 0 to (Base.Width/48)-1: 
    ------------> Spawn object at:
    ------------> X = base.BBoxLeft + (48 * loopindex("X"))
    ------------> Y = base.BBoxTop + (48 * loopindex("Y"))
    
    

    or

    Uses (Hierarchies & Temples)

    1-Create a Grid_Base for the objects, this will be the Parent and the Temple to create at Runtime

    2-Set the 9 objects in the Grid_Base object

    3-Add the objects to a Hierarchy with the Grid_Base object and make the Grid_Base as Parent

    4-Make the Grid_Base Object as a Temple and call it any name you like:

    for example "Grid Of Objects"

    5-Now to create the objects:

    on touch Grid 
    --------> Create Temple "Grid Of Objects" & Create Hierarchy = Yes
    --------> Set the Position as I showed you
    --------> Grid_Base remove children
    --------> Grid_Base destroy
    

    You are left just with the objects inside the grid

    There are many more ways... Good luck

  • tarek2 Sorry if it's a little confusing,My English is not very good, but here's an example of how I want it to work based on the example in the video I made.

    https://youtube.com/shorts/0G2LS_-WJH0?si=-k6w0_Cdzg-6jUIB

    Hoh, that is a totally different question, forgot about what I wrote Avobe.

    The best thing to do if you struggle to explain an issue is just make a video as you did or use pictures as that helps a lot.

    https://www.dropbox.com/scl/fi/law61d0jyxzbbwuh8xbb1/Position-a-Grid-of-objects-inside-another-Grid.capx?rlkey=e916zytgmwacjc4uhhg3rx9u7&dl=0

  • tarek2Can you help me with this? It's similar to the positioning you teach me

    How can I make it stop when I touch the grid, (which is tiled background) Will it be positioned correctly instead of off-screen?

    I was using this format

    -on touch grid

    > System create at (round(touch.x touch .Y) -48

    round(touch.x touch .Y) +48

    Etc...

    Honestly, I have no idea what you are trying to do:

    1-This code doesn't place an object in a grid:

    round(touch.x touch .Y) 

    As it just rounds the positions of the Touch XY. So just here I'm already confused about what you are trying to archive. I thought you were trying to place all your objects in a grid?

    Perhaps you meant:

    floor(Touch.X /48) * 48 
    floor(Touch.Y /48) * 48
    

    This places any object in the World Grid which has Tile (size = 48)

    This is assuming that the Origen Points of the objects are at the Top-Left otherwise you will need to adjust it slightly.

    2-Spawning Objects:

    Assuming that you are already positioning and centring the Touch XY correctly in the grid as I showed above then you can just use:

    Example:

    Variable = X
    Variable = Y
    
    Set X = floor(Touch.X /48) * 48 
    Set Y = floor(Touch.Y /48) * 48
    
    Spawn Object at (X - 48, Y)
    Spawn Object at (X + 48, Y)
    
    

    You dont need to round it again as you already centred the Touch XY variables.

    3-How can I make it stop when I touch the grid, (which is tiled background)

    3-How can I make it stop when I touch the grid, (which is tiled background)

    Here I am not really sure what you mean:

    Do you mean stop the full loop?

    Do you mean Dont create the current object?

    Something else?

    I am gonna assume that the problem is when you're trying to create an object you dont want it to be created inside the grid right?

    That means that you want to create objects only outside the Tiled BG grid.

    Though am confused as to why you use "-on touch grid" if you just want to create outside the grid.

    But since you asked:

    You can use for example the system:

    "Pick by overlapping point"

    Make it the Top parent condition

    Pick by overlapping point (Tiled BG) (X -48, Y) --------> And Inverted Negative
     -----> Spawn Object at (X - 48, Y)
    
    Pick by overlapping point (Tiled BG) (X +48, Y) --------> And Inverted Negative
     -----> Spawn Object at (X + 48, Y)
    
    
    

    Now, I have the feeling that you meant to ask:

    How can I create only inside the grid and "stop when is not Touching the Grid" instead of "is touching the grid" as that makes more sense to me.

    Use the same code but dont invert it.

    Pick by overlapping point (Tiled BG) (X -48, Y) 
     -----> Spawn Object at (X - 48, Y)
    
    Pick by overlapping point (Tiled BG) (X +48, Y)
     -----> Spawn Object at (X + 48, Y)
    
  • So I think that the time has come to deal with the inventory. but I have the same feeling as if I'm trying to eat a bigger fish than I can (metaphor).

    You have dropped a rather interesting specimen. and it made me think that I can also send you what I did and supplement my project with comments.

    https://www.dropbox.com/scl/fi/ldd0msm7rfopbxp8fh7ix/MBAZ.c3p?rlkey=5muo60eu6iwo1pvjj5rf0o7bv&st=1fjf50c2&dl=0

    In fact, I have been struggling with the inventory for quite a long time, it feels simple at the same time, but when it comes to practice, it is as if I am stuck in an invisible barrier that I cannot cross.

    I would recommend you to look for tutorials on inventories and choose the one that you think you could follow.

    If you are visual learning then maybe you could also look at Youtube tutorials and follow them step by step.

    If you spend some time learning you should be able to make the inventory that you envision.

    Some tips that could help you, though there are different ways you could approach this:

    -You can pin the slots to the inventory panel by Hierarchy. It will be easier if you make each slot tiles single so you can pick them easily.

    Or you can use a tilemap.

    -To Pick the different slots easily you can add an instance variable like for example "Type" and then you can set the slot to your different name types like (Hunting pants, Gorka pants, etc...)

    -Add the (Drag & drop) behaviour for the items that you place in the slots so they can easily drag and remove them from the slots.

    You may need an Array as I did or may not, depending on how complex you need it. For example, how do you know you have free tiles etc... You can do it via Boolean on the tiles "Ocupaid" and then set it to (True/False) or you could use Arrays.

    As I mentioned, these are just ideas as there are different ways you could do the same thing.

    The best thing is as I said earlier, choose a tutorial that matches the style that you want for your inventory then follow it, as normally they will show you everything you will need. Then you can start incorporating your own ideas once you have an understanding of how everything is working.

    Good luck.

  • I don't quite understand what I should do

    I just want to make it so that when the player has equipment, he changes the old equipment to the new one and vice versa

    And I also use a translator, because of which you may not completely understand me, as I do you

    But no matter what happens with that translator, I really need help and I will try to follow your advice

    Hi

    Yes, the translator can sometimes be inaccurate.

    I am still not really sure how your equipment works, as it can vary a lot depending on your needs and we dont have all the info.

    If I have to guess just by looking at your pictures alone:

    1-First picture you are not wearing Pants

    2-Second picture you Pick up pants1 from the floor and wear it

    3-Third picture, you pick up pants2 and wear it but you do not drop anything so it looks like you need to store the pants in an inventory

    4-Forth picture, you drop the pant2 that you currently wearing and then you put on any pants that you had in your inventory which in this case is pants1

    If that is correct, there are many ways to do inventories.

    Here is one example see if it helps you:

    https://www.dropbox.com/scl/fi/yxnkl8bbsn290emgkgip3/Inventory2.c3p?rlkey=2y86mbgnxcv8eflzt13t5agif&dl=0

    If this is not what you are looking for, then one possible solution is that you could explain it in your native language and then add a translation in English too, the forum allows that as long you post the translation in English. By doing that someone who speaks the same language could help you much quicker or at least will help in translating it to English.