BaconSwagg's Recent Forum Activity

  • becometile.x+radius*((impbase.x-becometile.x)/sqrt((impbase.X-becometile.X)^2+(impbase.Y-becometile.Y)^2))

    What does this do? Is it for checking if the block is close enough to the imp? If so then I would just check if the distance between them is less than the radius.

    distance(imp.x,imp.y,block.x,block.y) < radius

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So far it looks like it's working, but they can select blocks that should be too far away. Maybe making the radius a little smaller will fix it? I don't know if that's the best solution, but it might work.

  • Can you show a video of it happening or a picture of your code you are using to pick where they go?

  • You could compare the angle of the sprite. If it's between 0 and 180, set it not mirrored, and if it's between 180 and 360, set it to mirrored. :)

  • Pick whatever shape you want (in my example I'm using a circle)

    Create a sprite that has whatever shape cutout you want in it and cut it in half.

    Then make sure the image point is set to the right.

    Next edit the collision polygon to make it match your shape. (I used a lot of points, but you can probably get away with a lot less, especially if your shape has only straight lines)

    Now in the layout place 2 copies of the sprite. Set the angle of the one on the right to 180.

    From here it's as simple as giving the sprite the physics behavior and putting whatever physics object you want into it. :)

  • You can use "Set Flipped" in the sprite actions to flip the sprite vertically.

  • It's nice to see you got it working! Good luck on making your game! :)

  • Does the ground claiming system you describe work like this?

    Green is claimed, blue is available to claim, and red is unclaimable/unreachable.

    Spots become available if they are adjacent to claimed ground.

    If this is the case, then I think this could be a possible solution:

    Keep a list of the X/Y positions of claimed ground. (so you don't have to check the entire map)

    Also keep a list of the X/Y positions of ground that is ready to claim.

    Upon updating your map, run the list of claimed ground points through a function that takes them as parameters.

    This function will check the neighboring tiles to the claimed ground. (x-1, x+1, y-1, y+1)

    If the tile being checked is already claimed then do nothing, but if its unclaimed, change it to be available.

    Store the X/Y of the available tile in the second list and use that for referencing where the tiles are. (you can also use this to pick the closest point to the Imps)

    Lastly go through both lists and check if any points are in both of them. If there is a match, then remove the point from the available to claim list. (so that ground that is already claimed isn't mistaken for available to claim ground)

    (you could also probably do some optimization to remove points from the list that have all 4 neighbors already claimed so you aren't checking them multiple times)

  • What kind of game are you working on?

  • Im not entirely sure what you are trying to do but I will do my best to help.

    PositionToTileX(X) Converts an X coordinate in the layout to the nearest X coordinate on the tilemap. (same with PositionToTileY(Y) just with the Y coordinate)

    With Pathfinding you can also just pathfind to a position rather than a sprite. To get this position you can use TileToPosition(x). (again same with TileToPosition(Y) just with the Y coordinate)

    Can you elaborate a bit on what you are trying to achieve?

  • Sure! It's actually really simple. Just use the tilemap expressions "PositionToTileX(Mouse.X)" and "PositionToTileY(Mouse.Y)".

  • I don't know if this is the best solution, but you could store the state of each task in its own global boolean variable. False for incomplete and True for complete. I think this could also probably be done with a dictionary as well.

BaconSwagg's avatar

BaconSwagg

Member since 16 Jun, 2018

Twitter
BaconSwagg has 1 followers

Trophy Case

  • 6-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies