firkinfedup's Recent Forum Activity

  • Good idea, I'll give it a go, have you any idea of the optimal / largest size to use?

  • I've attached the solution capx to this post.

  • I'm currently making a game where I have made a huge graphic as the backdrop for the level (3764, 2524), the player scrolls around the backdrop. This works great on PC, but messes up on iPad and I assume it's something to do with graphic size limitations.

    What's the best way to work with large backdrops? I would ideally like a single image as piece the level together with individual layered graphics would take too long. Any ideas?

    Many thanks in advance.

  • okay maybe not it won't let me...

  • Here is the capx file

  • Okay finally got it, much simplified using functions now,

    RotatePointX (object x, object y, area x, area y, angle)

    ((Function.Param(0) - Function.Param(2)) * cos(Function.Param(4)) - (Function.Param(1) - Function.Param(3)) * sin(Function.Param(4)) + Function.Param(2))

    RotatePointY (object x, object y, area x, area y, angle)

    ((Function.Param(0) - Function.Param(2)) * sin(Function.Param(4)) + (Function.Param(1) - Function.Param(3)) * cos(Function.Param(4)) + Function.Param(3))

    then to use it,

    Call set position on the object

    x = Function.Call("RotatePointX", PinObject.X, PinObject.Y, PinArea.X, PinArea.Y, PinArea.Angle)

    y = Function.Call("RotatePointY", PinObject.X, PinObject.Y, PinArea.X, PinArea.Y, PinArea.Angle)

  • Okay so here's the issue, firstly cos and sin expect the value in radians not degrees. So to convert to radians from degrees you do this,

    pi * angle / 180

    Although oddly when I try this in c# compared to construct 2 I get,

    C#

    radians =1.5707963267949

    cos = 6.12303176911189E-17 - sin = 1

    Construct 2

    radians =1.5707963267949

    cos = 0.9996242169 - sin = 0.0274121336

    also the bog standard windows calculator gives the same answer as construct 2. Weird?!

  • I have managed to get a single algorith working for 90 degree angles, But for some reason it's not working with anything inbetween,

    X =

    (((((PinArea.X -PinArea.Width / 2) + random(PinArea.Width)) - PinArea.X) * cos(PinArea.Angle) - (((PinArea.Y -PinArea.Height / 2) + random(PinArea.Height)) - PinArea.Y) * sin(PinArea.Angle)) + PinArea.X)

    Y =

    (((((PinArea.X -PinArea.Width / 2) + random(PinArea.Width)) - PinArea.X) * sin(PinArea.Angle) + (((PinArea.Y -PinArea.Height / 2) + random(PinArea.Height)) - PinArea.Y) * cos(PinArea.Angle)) + PinArea.Y)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I'm going to try rotating the x and y coordinates manually to put them within the rectangle at any angle, I'll update with my findings.

  • Hi there,

    thanks for the speedy response! I've tried as you suggested and that makes it work for horizontal also, but the only problem is that it means the sprite has to be in either vertical or horizontal orientation, it's a car sprite and can rotate 360 degrees.

    Sometimes the sprite is at 45 degrees or some other arbitrary angle.

  • I should add that they rotate with the sprite just fine, keeping their location within the container, it's just when adding them to the container it only works correctly when the sprite is portrait in orientation.

    This is my event

  • That's brilliant thanks, I done something very similar, it's surprising how easy it is to pick up construct2. I'm hoping to actually finish a game rather than losing interest half way through. It's going well at the moment!

firkinfedup's avatar

firkinfedup

Member since 26 Feb, 2014

None one is following firkinfedup yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies