tarek2's Recent Forum Activity

  • I've read that native controls (buttons, scrollbars, etc) automatically get layered over sprites, and apparently there's no way to override this. I'm trying to determine if a touch takes place within a region defined by a sprite, even if the sprite is not the frontmost object (because a button is frontmost and overlapping the sprite).

    In other languages I've used a within() function to tell whether a click/touch takes place within the rect of an object, or a defined region on the screen -- basically, if an x,y point falls within a rectangle. How is this done in Construct? Do I have to compare the X and Y values of the touch separately?

    netdzynr I'm not sure if I understood your question properly but it sounds like you can use the Condition from the "Touch Plugin" which is >>>

    -is touching object(choose your object here)

    or

    if you wanna check the negative

    -is touching object(choose your object here)<<<<<Inverted

    Example:

    see here the Green object even if is behind the Orange object and you touch it will flash, doesn't matter how many objects are on top of it will still register the touch on the green object you can easily check if touched a region like you said with a rectangular object can be invisible too will not affect the touch

    https://www.dropbox.com/s/8wltup956z2ivs6/TouchObject.capx?dl=0

  • How can i make this pathfinding works and not stop moving all over the time

    https://imgur.com/a/N2hln

    Hi Executeor are you sure that you need the Path Finder for that?

    The reason I'm asking is that from the picture, it looks like you don't have any obstacles like (Tilemaps or obstacles sprites)

    Are you trying to do something like this?

    This is continuous

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

    This is every 1 second like in you Picture counting from Each Resource eaten

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

    The Reason that you Pathfinder is not working Properly is that Every 1 second you Set all the "Harvesters" to look for Path even the ones that already have and moving to a Path, is not only that To qualify for a path you have a condition if the "Resource" Var coming = 0 so when finds one you set it to 1 and move the "Harvesters" to that "Resource" but because a lot of times will not reach and eat that "Resource" as you reset all the Paths again every 1 sec, at the end will be many "Resource" left that will have Var coming = 1 that cannot be picked up again by the condition

    To resolve this you can add one more condition "Harvesters" >>Is not Moving along Path

    like this

  • > AnD4D

    >

    > Even that it sounds like you looking for something very specific and I'm sure that this is not what you want I couldn't resist to try it

    >

    > https://www.dropbox.com/s/pgvuvd0ijtwy1tp/SpaceShip%20PathFinder2.capx?dl=0

    >

    > To avoid the collisions checks you can use MoveTo >>>On Hit Target >>Pick Nearest selected Tile >> set selected to False and so on

    >

    > And on this two Places, I'm not sure if you needed to move on diagonals or to avoid those Grey pictures so I add one Blue square Tile on each to stop the diagonals, you can remove them if you don't need them

    >

    >

    >

    > This is With the MoveTo Behaviour

    > https://www.dropbox.com/s/ou6o7jppmwk1vua/SpaceShip%20PathFinder%28MoveTo%29%20Behaivor.capx?dl=0

    >

    Wow! Amazingly, I had just finished doing something similar. Mine doesn't use line of sight, nor 'nearest', but rather it will create sprites on the pathfinding node and will move toward the lowest node.

    It's pretty much perfect for what I need.

    Now I just need to figure out how to set the destination to a grid, rather than the mouse X & Y. If I recall correctly, it's something like: X % 2) * 32... but I honestly don't remember. Will need to search around again.

    It sounds very similar to the other one that I was doing without (Tiles, Line of sight)

    https://www.dropbox.com/s/v7jborvkpax1dra/SpaceShip%20PathFinder4%20TileMaps.capx?dl=0

    Glad you found the Solution

  • AnD4D

    Even that it sounds like you looking for something very specific and I'm sure that this is not what you want I couldn't resist to try it

    https://www.dropbox.com/s/pgvuvd0ijtwy1tp/SpaceShip%20PathFinder2.capx?dl=0

    To avoid the collisions checks you can use MoveTo >>>On Hit Target >>Pick Nearest selected Tile >> set selected to False and so on

    And on this two Places, I'm not sure if you needed to move on diagonals or to avoid those Grey pictures so I add one Blue square Tile on each to stop the diagonals, you can remove them if you don't need them

    This is With the MoveTo Behaviour

    https://www.dropbox.com/s/ou6o7jppmwk1vua/SpaceShip%20PathFinder%28MoveTo%29%20Behaivor.capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No Problem Man, Enjoy

  • I'm using sprites for the plot selector, when a plot is selected it's not changing the colour, it's spawning a separate sprite that is coloured depending on which player owns the plot (red for p1, green p2, blue p3 and yellow p4) would the boolean variable still work in this scenario? i feel like i'd have to run some kind of check with the plot selector so it can check if a sprite has already spawned on the plot or not before it can spawn a new one, but there in lies my problem, I'm not sure how i'd run the check, one suggestion i was given was to use an array instead of my current method, so i've been reading up on arrays in the mean time so i'll know how to implement the array if it turns out to be the best solution

    Kazuato

    I was referring more to how you Map for the Land is build you know (grass, sand, water etc...) if they are all Sprites as Tiles the easiest will be to add a Boolean "Selected" like a mentioned above.

    If you can share a mini Capx just enough to show your problem someone can have a look and give you quickly the Answer you need, other ways it will be more as keep guessing.

    Since you mention this

    [quote:wv8u8ysm]I'm using sprites for the plot selector, when a plot is selected it's not changing the colour, it's spawning a separate sprite that is coloured depending on which player owns the plot (red for p1, green p2, blue p3 and yellow p4)

    I guess "plot selector" the white one is a separate sprite swell so maybe you can try this

    The Loop that you have that goes Tile by Tile

    Subevent: is The white "plot selector" Not Overlapping "coloured already Spawned Sprite"

    Pick Random Tile >>>etc.........

    This way the "plot selector" knows if there is any Tile already selected if that makes sense for you?

  • Hi

    I needed a distraction so I gave it a try just for fun, this is the Results, obviously, you will need to make some changes like the Bodies of the characters to Rigid Bodies like in the Game you showed and more things but those I leave it up to you.

    Was done in a hurry so you may find some bugs just let me know and I will have a look

    I hope it Helps

    Capx: https://www.dropbox.com/s/vp6y5fdl4g0f22k/WalWestGunBattle.capx?dl=0

  • Kazuato

    Hi

    I'm not sure if I understood properly

    The square Picker stops when picks a Piece of land and highlights it with different colour and moves on to select the next ones doing the same, by the end of the Video they where 4 Picked?? If this is right now the question is what do you use for the Land (TileMaps or Sprites)?

    If you use Sprite as a Tile: Then you can add a Boolean "Selected" to the Tiles, Then when you loop to Pick a piece of land anytime it picks one you set the Boolean "Selected" to true

    So in the Loop you Pick by adding one more condition Tile is "Selected" <<<< and inverted = which means is not Selected

    If you use a TileMap instead: That's different history as you cant use instance variables on a single tile, you gonna have to store their Tile Number Grid where are located example (X1, Y1) = Tile 1,1 and on the loop ad the extra condition (is Tile not equal = To the Tiles selected previously X,Y)

  • rbailey83

    I have posted 3 different ways to do similar thing in this Post, I hope it helps

    https://www.scirra.com/forum/viewtopic.php?f=147&t=191444&p=1121903#p1121903

  • that one was for comparing player's position with very top and very bottom box

    But this question is not related to that

    This is different Question and I'm here not comparing with player

    here only boxes are scattered in layout and a variable added to Box

    and I only want to Identify their appearance No. from left to right and put their order of appearance to that variable.

    luckyrawatlucky

    dop2000 already gave you the Answer is exactly the same Thing, just remove the comparison against the Player, The for Each order will short out the Condition that you enter there to compare in this case is by (X)

    Capx: https://www.dropbox.com/s/56enru0ye9n1bvb/For%20Each%20Order%20by%20spriteX.capx?dl=0

  • graham-s

    Here is one way of doing it, one thing I wasn't sure is when you say >> Leave the key on the same "spot" do you refer to their starting Point Position or in the Place of the New key Found?

    anyway I leave you both examples to make it easier, hope it helps

    Leave the key on his Starting point capx:

    https://www.dropbox.com/s/kgqho9kjeua4m86/Doors%20%26%20Key%20Linking%201.capx?dl=0

    Leave the key on the spot of the Newly collected Key capx:

    https://www.dropbox.com/s/2gve7ifwfyupi80/Doors%20%26%20Key%20Linking%202.capx?dl=0

    You can Remove all the Txt boxes are just for Debugging

    Edit: I just saw that kriand was Faster and had similar Idea haha, but I leave it just in case, the more examples the better

  • Looks like any type of movement is affected by the jerky thing not only the Bullet Behaviour, maybe has something to do with the last c2 updates? maybe

    Here is a simple capx I removed all the Extras and is not moving by Bullet still does the same

    https://www.dropbox.com/s/14nxrodiir87k9q/AutoRunner%20Dino2.capx?dl=0

tarek2's avatar

tarek2

Early Adopter

Member since 26 Jan, 2016

Twitter
tarek2 has 12 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x5
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

15/44
How to earn trophies