mahdi71's Forum Posts

  • how can i do like this :

    [attachment=0:wuqx8o14][/attachment:wuqx8o14]

    i mean the blue edge fog

    ...

    thanks

  • Vx and vy are the x and y velocities of the target.

    Instead of atan2(y,x) you can use angle(0,0,x,y)

    how do i calculate Vx and vy ?

    i still looking for formula ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I edited my post above with an formula that is language independent, I just googled the formula for you

    thanks .. but i know that .. i whant the formula in construct 2 ...

    if anyone can change the formula to construct 2 please do it .. ?

  • Hope this helps:

    function aimAngle(target, bulletSpeed) {
        var rCrossV = target.x * target.vy - target.y * target.vx;
        var magR = Math.sqrt(target.x*target.x + target.y*target.y);
        var angleAdjust = Math.asin(rCrossV / (bulletSpeed * magR));
    
        return angleAdjust + Math.atan2(target.y, target.x);
    }[/code:1lcl92kw]
    

    thanks ..

    but what is "target.vy and target.vx" ?

    and construct 2 dont have atan2 ... (i think i must use "angle" but how ?!)

  • hi

    i can not use turret behavior so i made my own turret system ...

    but i need for Predictive aim system

    what is the formula ?

    i have variables like :

    • projectile speed
    • turret and target position and angle

    and i know my target moving or not

    ...

    thanks

  • 1. Please give an example of how picking only an instance of an object type would help. Also see the provided example capx.

    2. Construct2 has a .

    3. It's not up to Construct to do it, but actually to you to delay those type of operations so the request to regenerate the obstacle map is not happening every tick.

    4. Use the action "Request full screen".

    Hi.

    Thanks for tip 4 now I can use full screen and I am so happy.. its good...

    1. I have 2 player and each player can create tank and I must use diffrent instance variable like group and for player 1 set group to 1 and for player 2 set that to 2.. then I must pick tanks with instance variable group 1 and set target to other group... if we use tank as target of tank ..then tanks shoothing themself.

    I had to make my own targeting system for that...

    If its still unclear i can upload a capx example...

    ...

    And I just say dynamic pathfinding is missing in construct 2 ...

  • hi,

    i working with construct 2 and this things i think must be added in next updates ...

    1.Turret behavior :

    we can not pick some of an object (or family) as a target .. like objects with different instance variable (like different group) as a target.. (turret behavior just add all family or object as a target ....)

    .........

    2.debug system :

    construct 2 is fast .. so faster then programming but if you have a bug it can get so much of your time because you must use somethings like texts or... to see what happens .. if when we start the game in preview we could see wich event and action runs (like when an action or event run they color change to green and events and actions which not running they get normal color..)

    .......

    3. dynamic pathfinding : pathfinding behavior is so good ... but ..

    almost all good game engines have dynamic pathfinding .. and i know its so difficult .. but it can happen .. i mean pathfinding system must get more updates...

    Suggestion : instead of generate obstacle map for each object, use just one obstacle map and generate that map in so many frame (dont generate obstacle map in one frame .. generate just some of that in each frame ... then we have obstacle map in like every 2-4 seconds .. because every piece of that maked in one frame ...then use the same thing for calculate patch for each object .. so we have no lag ... and objects no more overlap eachother

    and we can have heavy algorithms like dynamic pathfinding…

    construct 2 just do every thing in 1 frame and this make this good engine a little solid … you just can do heavy thins in more then one frame…)

    ..

    .......

    4. export to full screen windows game: ... (node-webkit is good but we can not have a really full screen mode (its just have maximum window size))

    ......

    thanks for this good game engine

  • mahdi71

    You could also use anglediff(angle1,angle2) when doing the comparison, which should be ok with negative angles.

    Here's an example

    [attachment=0:221ey5kj][/attachment:221ey5kj]

    Just drag the blue target around and the turret will follow it.

    Yes .. its better .. thanks ...

  • ok ...

    you guys right

    but angle(Turret.X, Turret.Y, Target.X, Target.Y) give me a number less then 0 sometimes like -110 so i add the number to 360 if that number is less then 0 then this solve my problem ... thanks ...

  • Expression "angle(x1, y1, x2, y2)" will calculate angle between two points. Is that what you asked?

    No , i want to Calculate Angle Toward Position of another object ..

    look in this example:

    dl.dropboxusercontent.com/u/5426011/examples%209/turret.capx

    my problem is the turrets fire when they finde the target. but i want they not do that until they rotate toward the target .. like turret behavior

    ....

    i can not use turret behavior because i want to set object with diffrent instance variable as a target

  • hi,

    how do i Calculate angle toward position ?

    in construct 2 we can set that and its good .. but i want to get it and test if my object angle is toward another object position then do something ...

    thanks....