facecrime's Recent Forum Activity

  • R0J0hound thank you for your example, and thanks for your ongoing patience and support for that matter!

    newt I'm aware that I'm losing the circluar route this way, but that's fine.

    I don't understand how you think I should use LoS to improve this. Can I get you to point me there?

  • First one is my trying to visualize what I want the resulting behaviour to look like instead of long text.

    Second one is what i found online, some bloke determining the intersection point of two circles (P3)

    For my situation that translates to:

    P0 is the player

    P1 is the enemy

    r0 being the circling range

    r1 being the destination distance

    and yes, P3 is what I want to find

  • Why, does that have some way of providing a position for my enemy to move to that I've been missing so far?

  • And while I'm here posting, can anyone suggest a better approach?

    I previously achieved this using a bullet behaviour and moving the enemy orthogonally while looking at the player.

    But using pathfinding just prevents collision issues with environment better.

  • Hi,

    (edit:) tl;dr: I want to create a position on a circle, found a formula for it, but am not sure what the highlighted part means (below)

    Quick context:

    My enemies are supposed to circle the player (roughly) when getting within a certain distance of him.

    I want to use pathfinding, so I simply want to create a position within said distance and have pf resolve movement.

    Now i found this online and it looks just like what i need; but I have trouble reading one particular line.

    a = (r02 - r12 + d2 ) / (2d)

    h = r0 sinP0 ((or) r1 sinP1)

    P2 = P0 + a ( P1 - P0 ) / d

    i.e.,

    x2 = x0 + a (x1 - x0) / d

    y2 = y0 + a (y1 - y0) / d

    x3 = x2 ± h ( y1 - y0 ) / d

    y3 = y2 ± h ( x1 - x0 ) / d

    So this translates nicely to my setup, my only trouble is that black line:

    what is "r0 sinP0"?

    sinus of a position vector, multiplied by the radius? is that what it's saying? how do i take sinus of a vector?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound Alright, thanks a ton! It seems to work.

    For future reference or if you care to double check, this what it looks like:

    Wasn't sure where else the delta time needed to appear, but this seems to do as i intended (from a first glance)

  • Hi,

    my gamepad controls apply axis-speed like this:

    Gamepad.Axis(0,0) * Player.CurrentSpeed * dt[/code:2noza82q]
    
    I try following R0J0hounds suggestion to calculate velocityX like this:
    vx = speed * cos(angleOfMotion)
    
    so I calculate my directional speed like this
    
    [code:2noza82q]Gamepad.Axis(0,0) * Player.CurrentSpeed * dt * cos(angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1)))[/code:2noza82q]
    
    However when I use this formula in the Predicitve Aim formula from this thread
    
    my baddies miscalculate the angle to hit me when shooting at me.
    
    Using 8direction vectorX and Y for keyboard controls it seems to work great btw ...
    
    I'm guessing that i'm not getting the directional speeds correctly, but the syntax seems beyond me.
    Can anyone help?
  • hm, not possblie then?

    how about doing a manual line of sight test? how would i go about that, we don't have raycasts in 2d, do we?

  • Hi,

    my enemies spawn their projectiles from an image point that is not the spites' origin.

    This results in enemies postioning themselves at corners that they look past but cant shoot past, cos the origin has LoS but not the gun. So the projectile gets stuck in the wall/corner.

    Is there a way to have the LoS behaviour check for a different position than the object's origin?

  • quick gif to share the state of affairs

  • LittleStain Well, read your comment, thought, "Duh, of course, I tried that. Didn't help." But tried again. Suddenly it works ...

    must have had other issues when trying earlier. Thanks

    Wondering now:

    My Enemy Bases dont use For Each and work fine, detecting the player, approaching, attacking, retreat to cover.

    Its probably because to do with that the bases work largely indepedantly and dont need to refrence the other family.

    What difference does the for loop make to picking across families?

  • Hi,

    my enemies consist of a 'base' and a 'turret', each sorted into respective families.

    Both go through a set of states to define their behaviours. Base and turret are grouped through containers and pinned together.

    My bases work quite well, but ironicly the simpler turrets cause trouble.

    They should all be firing individually at their own pace, creating different types of projectiles.

    But atm projectiles are spawned either from only a single turret instance or all instances at once.

    For state transitions a variable in the enemy types defines which state to go to upon exiting a given state.

    This is the main state loop of the turrets:

    This is one of the weapon types:

    I'm having trouble understanding what referencing functions need, I tried lots of variants but i get either only a single turret instance to shot or all instances firing at once.

    Can anyone point me to the glaring mistake(s) I'm making?

facecrime's avatar

facecrime

Member since 25 Mar, 2014

None one is following facecrime yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies