BaconSwagg's Forum Posts

  • Also, for more details:

    Currently I'm using a dictionary for storing keybinds. So I have ("UP":87) for up (87 is the key code for W).

    I use Keyboard > key code is down > Dictionary.Get("UP"). That goes for WASD and any abilities.

    That is the current setup.

    What I want is to have different ability slots. The player can equip any ability to any slot and when they press the button for that slot, the assigned action will occur.

    I'm looking for maybe a simpler/more elegant solution to my problem. I've got some ideas, but I wanted to see if anyone has a better solution.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So what I'm trying to do is this:

    set keybind for each ability to whatever key is desired > press key assigned to an ability > do action

    I'm having trouble setting this up because I want to have multiple different abilities, but I don't want to have a bunch of repeated code for every ability and its variants. Any ideas?

    Tagged:

  • I'm not sure if I'm following correctly. Can you elaborate on what specifically you are trying to create?

    Also, for deleting the extra sprites you could go through all of them and see which ones is the biggest. Or by the order they were created. Or you delete the previous ones as you go before adding a larger one.

  • I think it's probably that your "Exam" layer isn't set to Transparent, so when objects go onto layers below it, they aren't visible. To change it, just go to the Layer Properties bar and check the box that says "Transparent". :)

  • Maybe you made an error when trying to implement it into your game? A screenshot of you events exactly could help diagnose the issue.

  • Can you post a picture of your events?

  • You should subtract one from the second angle of each condition. This is because the range of one ends at the same angle that another one starts at, so both actions will trigger at the same time.

    Quadrant 1: first angle 315, second angle 44 <-

    Quadrant 2: first angle 45, second angle 134 <-

    Quadrant 3: first angle 135, second angle 224 <-

    Quadrant 4: first angle 225, second angle 314 <-

    Also make sure you put the objects in the right order in the angle() expression. In your example its using Sprite1 as the center point rotating towards Sprite2. If you intend for Sprite2 to be the center point then the angles you are getting from "angle(Sprite1.X,Sprite1.Y,Sprite2.X,Sprite2.Y)" are going to be inverted, and it should instead be "angle(Sprite2.2,Sprite2.Y,Sprite1.X,Sprite1.Y)". :)

  • You can actually do this with just the For Each Element array action!

  • Actually very simple! In the object properties go to the Line of Sight behavior propeties. Change the Obstacles from Solids to Custom. Then Add Action > your object > Add Obstacle > the object you want it to collide with.

    Then just do that for every object you want the raycast to collide with. (you could also add all those objects to a family and add that family as an obstacle) :)

  • loopindex gets the value of a currently running loop. For loopindex("X") it's getting the index of the loop named "X".

    tiletopositionX() converts a tile X index to a X co-coordinate. So the position of the tile using layout coordinates.

    For tiletopositionX(loopindex) it is doing exactly that but the x index you are converting is based on the index of the loop. This is very helpful if you want to run through all the tiles.

    In this example I've created 2 loops.

    The first one is named "X" and runs from 0 to the tilemap display width. Which is how many tiles it can display across its width.

    The second one is named "Y" and runs from 0 to the tilemap display height. Which is how many tiles it can display across its height.

    Here I'm setting the tile at the position in the loop. So loopindex("X") is for the X index and loopindex("Y") is the Y index. Since the loop will run through every single tile on the tilemap this will set them all to whatever tile I choose.

    Going through all the tiles like this is great for flood fill because you can check every tile and the tiles around that tile to see where the walls are.

  • Interesting, I think you could maybe check if the block is too far away. So if the distance is greater than an amount, stop the pathfinding. I also think that having a list of which blocks are available for mining and then picking a random or the closest one out of that list may make this easier.

  • Are you trying to have a UI layer that always stays on screen? If so, you can go to the layer properties and set the Scale Rate to 0%, and the Parallax to 0% x 0%.

  • 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

  • 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?