cincipon's Recent Forum Activity

  • Hmm. I see that your problem is more complicated than I thought from your description.

    If you want the magnet to repulse, perhaps it would be best tomake an invisible sprite around it, and when the player collides with the trigger sprite you could send it a physics impulse based on the angle between the player and the magnet?

    As it stands now, your code has too much going on aside from the problem at hand for me to jump into.

    Good luck!

  • The reason is that .3333333333333333333 is not 1/3. It is an approximation of 1/3, and to go between the two needs some human judgement, e.g. IF statements.

  • I am almost certain that there is no simple function. The simple method is as I described. Decide upon a precision threshold, and check the digits to the right of the decimal place. There is a method to truncate into an integer, so you can make two strings and concatenate them. so your 8/3 as 2.333333 becomes 2 and 1/3.

  • I'm suggesting that since it works fine when gravity is normal, having a condition that checks to see if gravity is reversed will let you then add an action that reverses the force of the magnets. The best place I see to do this is right before you "Set Platform VectorX" and "Set Platform VectorY".

    Something like :

    On Condition "GRAVITY IS REVERSED"

    Action "fx = fx * -1" Action "fy = fy * -1"

  • So the MovingAngle is the current angle, but it could be negative, so you add 360 to ensure it isn't. I'm assuming you add 22.5 to force it to choose one higher (a rounding effort) and then you mod it by 360 to get it in range (0-359). You divide it by 45 to see which animation you should be showing because there are 8 directions, and 8*45 = 360.

    If you really want 32 animations you'll need to divide by 11.25, and instead of 22.5 you'd add 5.625

    (I could be totally wrong too!) BUT I am right in saying your game and your hero sprite are wonderful!

  • perhaps it is as simple as

    if gravityReversed > fx *= -1, fy *= -1 right before you add the fx and fy to the vectors at the end?

  • Decide how forgiving you want to be, then create some fun if statements!

    If x <.334 and x > .332 string = "1/3"

    if x = .25 string ="1/4"

    if x < .1668 and x > .1666 string = "1/6"

    do this for every possible fraction you care about.

    would be smartest to create a function to contain these checks as well.

    FUNction

    function string decimalToFraction(x){

    if if if ...

    return string;

    }

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wonderful! I _LOVE_ Smash TV! Good luck.

  • Aha, well I stand corrected. I'll give this a shot.

  • I'm considering it, though I don't know if I'll use C2 just yet. Still time to decide on both! Have you made one before?

  • The action is "Apply Impulse at Angle" and the Parameter is the formula to find out the angle between the player and the object to apply impulse to.

    So whenever you select an action (almost any action) there is a window with a textbox that you can type into to input X and Y or whatever you are inputting. Above (I think) that is a greyed out textbox that appears, and becomes opaque when you hover over it (@Ashley I think this is a bad UX decision). Once you've found that, you can pcik the System object, then scroll down and pick the angle expression, and it will help you along.

    Once you get more used to this sort of thing it will become MUCH friendlier to say sytem.angle(x,x,y,y) or object.Platform.VectorY than it will be to say click this choose that do this. =) Good luck!

    Play around with it, if you fail, put together a capx and link to it here and we can look into it.

  • Very likely you would expand a circle outward from the center of the player (maybe using Sprite.setScale()?), and check for collisions at each step. If a collision occurs, you would move the enemy(or whatever) object at an angle (found by taking the system.angle(x1,y1,x2,y2).

cincipon's avatar

cincipon

Member since 27 Feb, 2013

None one is following cincipon yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies