R0J0hound's Forum Posts

  • Here it is further refined to match your example.

    dropbox.com/s/pcbiajcrf4wsr8p/hex_pathfind2.capx

    It uses a state variable to switch what is happening. Basically it does this:

    *click to find path for payer. All enemies are walls.

    *move player on path

    *loop over each enemy, make all others walls, pathfind to player and move one space.

    -- it does that every 0.25 sec for 0.75 sec.

  • I think you will get responses biased toward Construct because this is a construct users forum.

    I don’t think most have really used gdevelop 5 here. I looked at it before but not too much.

    Mobile exports are typically done with a service since it’s pretty involved to do manually. So I can see why both charge for it.

    Apart from that it’s mainly a personal choice which to use. You could try to make a game in both and see if the workflow differs and which you prefer.

  • Ran out of time but here is what I ended up with.

    It finds a path from all locations to one spot, and moves the enemies toward it. The enemies will try to move around other enemies if they are blocked.

    left click to add an enemy to an empty spot. They will try to move toward the mouse.

    dropbox.com/s/17oopqy8qfu20pp/hex_pathfind.capx

    Probably ended up more complex than i anticipated. I have an idea how to make things tighter but it's slower.

    As to your question with your capx, I have no idea. Maybe there is something simple that will allow it to do what you're after, or it's not really possible. I opted to go from scratch instead of figure out what is possible with the pathfinding behavior. From scratch give more control and is a bit quicker to figure out.

    Anyways, maybe my capx is helpful but it's not setup like you have your game.

    cheers

  • I have a slightly different solution that should work but it’s not completed yet.

    Basically it ranks the enemies by their cell distance from the player, then for each one:

    Mark all the other enemy cells as blocked

    Find a path to the player and move one cell.

    I’m opting to not use the pathfinding behavior to avoid the waits. I’m using an event based function that finds a path immediately.

    Anyways, I should be able to finish and post it tomorrow. The events will look very different to yours, but it should run the way you’re after.

  • Ok, so if the up, right and forward expressions are bugged. However the look expressions work. You can subtract the camera position from the look expressions, normalize it to have a magnitude of 1, and use that to be able to shoot forward.

    Anyways, here is an example.

    dropbox.com/s/7fz4uff391at3ms/shoot_forward_3d.c3p

    You can probably discard all the camera related stuff, and just use whatever you already use. It was just for the test.

    Also, I don't think you'll want to be using a sprite for bullets as they aren't always aligned to the view.

  • Probably timeElapsed/period.

    So you’d maybe do one of the following:

    Var timer=0
    Start of layout
    — enable sine
    — set timer to 0
    
    Every tick
    — add dt to timer
    — set text to timer/period & “ cycles”

    Or

    var startTime=0
    Start of layout
    — enable sine
    — set startTime to time
    
    Ever tick
    — set text to (time-startTime)/period &” cycles”
  • The expressions forward, up and I think right (or it may be left) are indeed unit vectors. Aka. If you measure their length it will be 1.

    Anyways, from what you said about forward being (1,0,0) makes me think it’s broken. It should give different values depending on the camera orientation.

    Or maybe forward, right and up were mixed up. Just spitballing here based on your testing results. I haven’t tested anything.

  • Well that’s no good if they are always the same value. 3D in c3 seems broken and incomplete.

    Maybe those values get set when you use lookAt and not when you set the camera angle?

    If the forward expressions can’t be relied on then maybe you can calculate them manually from the expressions that do?

    I’m hoping the camera xyz expressions do work. Then maybe there is an expression to convert a screen location to a position in 3D space? Then you’d subtract the camera position from that point and divide it by the distance between the points to get your own forward vector. I honestly am not sure if there is and expression that gives a 3D position from the screen though.

    Another idea is the build a 3x3 matrix of the cameras orientation manually with the same info you feed into the 3Dcamera object. Seems labor intensive though. Or maybe the js api provides more access the stuff in the 3Dcamera.

    Anyways, just some ideas. I unfortunately don’t have the time to try the ideas or see if I’m missing something obvious.

  • Here’s one way. Give your bullet sprite three variables: vx,vy,vz.

    Then add events like this:

    on click
    -- create bullet at (camera.x,camera.y)
    -- bullet: set zelevation to camera.z
    -- bullet: set vx to camera.forwardx*200
    -- bullet: set vy to camera.forwardy*200
    -- bullet: set vz to camera.forwardz*200
    
    every tick
    -- bullet: set x to self.x+self.vx*dt
    -- bullet: set y to self.y+self.vy*dt
    -- bullet: set zelevation to self.zelevation+self.vz*dt

    That would shoot a bullet in a straight line from the camera with a speed of 200.

    The only thing I’m unsure of is how c3 does zelevation values. They initially made it 0 to 100 so you may need to scale the z stuff by some value.

  • One way to do it is to just put those control circles around the sprite. You can do it with some math. Then when dragging one of them you can update the other ones, and the size of the sprite.

    Anyways, here is a way to do it in a fairly compact amount of events:

    construct.net/en/forum/construct-2/how-do-i-18/resize-handles-example-48892

  • radbrothers

    Hello,

    This plugin is basically without support and abandoned. However best I recall flood fill works best when the canvas doesn't have transparent pixels. Other than that I have no tips on how to make it work on ios or anything like that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's my attempt at it. The arrow keys change that angle you'd like to turn. It then tries to turn at grid locations, otherwise it keeps moving forward. It also lets you turn 180 at any moment. Seems to give a pleasing result to me.

    dropbox.com/s/t5uwju945as85o7/pacman_movement.capx

    Edit:

    Another refinement of the idea. The previous capx would give slight pauses at grid positions. Now it should be smooth over grid locations.

    dropbox.com/s/h6ujpdfyvxfh1yd/pacman_movement2.capx

  • Try the formula again. I made a typo. One of the +'s needed to be -.

  • Ah, I love math like that. Google of course can give you the formula, but it’s fun to derive it.

    Two points on the line

    X0,y0

    X1,y1

    The point to get the distance of

    Px,py

    Dist = ((x0-x1)*(py-y1)-(y0-y1)*(px-x1))/distance(x0,y0,x1,y1)

    Anyways that’ll give you the signed distance. It will be negative on one side of the line. Use abs() to make it positive.

  • I think you can do the dragging by having an invisible sprite with drag drop and physics connected to the other object with a revolute joint so it does the dangling.

    From the looks of it you should be able to do it without physics by just changing the angle of the object and clamping the y position.