R0J0hound's Forum Posts

  • You could normalize the angle to a range of (-180,180) with angle(0,0,cos(a),sin(a)) before comparison.

    Or you could use the sprite condition "is within angle" or "is between angles".

    Or you could use the anglediff(a,b) expression to find the angle difference in the range of (0,180).

  • digitalsoapbox

    I can't reproduce the issue. It's working fine here in Firefox, Chrome and NodeWebkit. Can you post a capx with the issue?

  • So you're trying to measure reaction time? The "on key pressed" events are triggers, so they can happen at any time instead of just on a tick. Also the "wallclocktime" system expression may be of interest to you. It is the time elapsed (in seconds) since the start of your game, and it isn't affected by the framerate.

    As far as changing the framerate; you can't in C2. The framerate will basically try to match the monitor refresh rate which is usually 60hz.

  • isasaurio

    It works fine here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is generic guide on how that type of game is done:

    http://www.extentofthejam.com/pseudo/

    I was able to get it working in Construct Classic here:

    viewtopic.php?t=58596&start=0

    And some discussion about doing it in C2 can be found here:

    viewtopic.php?f=156&t=77718&p=640214&hilit=pseudo#p640214

    An example for C2 hasn't been made as of yet though.

  • You could try the custom movement behavior's push out action but that doesn't work too great for moving objects.

    One idea is to treat the enemies and player as circles. Then see if they collide if any two of them have a distance between them less than the sum of their radius'. Then the overlap between them would be radius1+radius2-distance. To resolve the collision just move each object half of the overlap away from each other.

    Also you'll want to either set the speed to zero, bounce the objects or only set the velocity in the direction of each other to zero. The last two can be done with the help of a vector projection:

    Speed_at_angle= velocity_x*cos(angle)+velocity_y*sin(angle)

    Then you can eliminate speed in that direction by:

    set velocity_x to velocity_x-Speed_at_angle*cos(angle)

    set velocity_y to velocity_y-Speed_at_angle*sin(angle)

    or to bounce do:

    set velocity_x to velocity_x-K*Speed_at_angle*cos(angle)

    set velocity_y to velocity_y-K*Speed_at_angle*sin(angle)

    Where K is 1 for no bounce to 2 for fully elastic bounce.

    I have an example of it in the first capx in this topic:

    and a more advanced version of the walls can be found here:

    But there are probably other ways.

  • Alpro

    Having a fixed flight time and having a different launch angle isn't physically accurate since it requires each cannonball to have a different gravity.

    Do do a launch here are the formulas. "angle" is the launch angle and t is the flight time. You'll need to change event 5 to use ball.gravity instead of gravity in the equations.

    ball set vx to (x_target-x_start) /t

    ball set vy to ball.vx*tan(angle)

    ball set gravity to 2*(y_target-y_start-ball.vy*t)/t^2

    bear13

    Probably no, the turret behavior is for straight shots, but with some creativity you possibly could do something similar with events.

  • epicjelly

    r169 is the latest beta. A link to it is on the center of the bottom of the page, right above the total downloads counter.

  • The math is simply positioning the objects on a circle.

    x = center.x+ radius*cos(angle)

    y = center.y+ radius*sin(angle)

    Only it's from the side so y doesn't change. With it you can calculate z for sorting if you like later.

    x = center.x+ radius*cos(angle)

    z = radius*sin(angle)

    That is the basic formula for positioning objects. You change y like in any other game and you change the radius and angle to calculate the x position. The scaling can be done with the sin() function. Notice the value of sin() at these angles:

    sin(0) =0

    sin(45)~=0.707

    sin(90)=1

    sin(135)~=0.707

    sin(180)=0

    It looks like it would work well to set the width to BrickWidth*sin(angle). With it the bricks will be full width when facing head on (90 degrees) and will disappear to a sliver as it turns. Well, it will also be full width when facing away (270 degrees) but we can hide them when the z is less than 0 to hide that. Also keep in mind changing the width is only necessary for the wall bricks, the platforms just change position in the game.

    Here's a capx with just the bricks:

    https://www.dropbox.com/s/nnoeswz440ur1 ... .capx?dl=1

    The bricks are placed in a circle taking into account the tower's radius and how many bricks you want per layer. From that we can find how wide each brick should be and the angle difference from one brick to another.

    First calculating the brick width is simple enough. We just take the length around the tower (or the circle circumference) and divide it by the number of bricks in a layer.

    Circumference = 2*pi*radius

    BrickWidth = 2*pi*radius/numBricksPerLayer

    NOTE: The I'd like to point out that the "BrickWidth" above and the one in the expression to set the sprite's width is different from the sprite's actual width.

    Next calculating the angle of one brick to another is even simpler. Just divide 360 by the number of bricks per layer.

    Finally the loop to create a ring of bricks would look like this:

    start of layout

    --- set brickwidth to 2*pi*radius/numBricksPerLayer

    ----- repeat numBricksPerLayer times

    -------- create sprite

    -------- set sprite.r to radius

    -------- set sprite.a to loopindex*360/numBricksPerLayer

    Anyway that's most of the math you'd end up using.

    -cheers

  • For a quick solution using

    http://simpleweatherjs.com/

    you can do this:

    https://www.dropbox.com/s/jtwuivwa9cia8 ... .capx?dl=1

    /examples22/weather.capx

    No temperature maps though, for that there are some other libraries that appear to require a signup to use and are only free up to a certain amount of uses per day.

  • eli0s

    It's a limitation of the flood fill algorithm used. To be able to fill those gray pixels too would require an algo that fills pixels whose colors are close to the original by a threshold.

    PopperOfCorn

    It's a known bug when webgl is on. It works if webgl is off, but other than that I don't have a fix for this plugin. However look at the Paster plugin as it works there.

  • In the editor you don't have access to any html5 stuff, only what's listed here:

    https://www.scirra.com/manual/21/the-edit-time

    You can draw colored and textured quads with that so you possibly could do more than just wireframe. The rendering engine in the editor is just 2d though.

  • irina

    From the C2 manual:

    https://www.scirra.com/manual/126/system-expressions

    [quote:3dttumq0]CanvasToLayerX(layer)

    CanvasToLayerY(layer)

    Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

    LayerToCanvasX(layer)

    LayerToCanvasY(layer)

    Calculate the canvas co-ordinates above a position in layout co-ordinates for a given layer.

  • irina

    For the first capx the issue is the layer scales aren't considered currently.

    The second capx is the same. So moving the objects is a solution or you can maybe look into the system expressions to convert layer positions to screen and vise versa.