R0J0hound's Forum Posts

  • The or event on line 323 is unpicking the function object so no function calls will work. The fix is to instead of using the parameter compare condition, use the system compare function.parameter(2)=0.

    New bug:

  • Problem Description

    Function object can be unpicked by "or" event.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/542 ... g_bug.capx

    Description of Capx

    Under an "or" event that compares 0=0 or function:param 0=0, it sets the text to "didn't run function" and then calls a function. The function should immediately set the text to "ran function".

    Steps to Reproduce Bug

    • Create an or "event" with a system compare and a function param compare
    • Add a function call action, as well as some other actions.

    Observed Result

    The text displays "didn't run function".

    Expected Result

    That the text display "ran function".

    It seems the function object is getting filtered. I would expect that single instance plugins would not be picked/unpicked.

    Affected Browsers

    • Chrome: YES
    • FireFox: Untested
    • Internet Explorer: Untested

    Operating System and Service Pack

    Windows 10 x64

    Construct 2 Version ID

    r240

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    If you have a capx that uses a plugin that you bought previously but no longer have, couldn't you ask the seller to send you another copy instead of buying it again? Otherwise you couldn't you also edit the xml files of your project and remove all references of that plugin?

  • round(X/32)*32

  • Objects regardless of weight will fall at the same rate. Air resistance will make something like a feather fall slower, however the physics behavior doesn't do that.

    You can try both increasing the speed and the gravity in the behavior.

  • The path itself can be defined any way you want. The spine suggestion is a valid way to do it. The hard part is dragging the object along a path which is different than having the object move along a path.

    My example with an arc just simply moves the object to the closest point on the path. That works well since the path is mostly in a line. I guess just moving to the closest point would work for a triangle, square or circle as well. The only issue in my mind is you can then move directly across to the other side instead of having to go around the edge. Using the closest point wouldn't work well for more complex paths.

    My incomplete idea for a better general case solution would be to make the path a polyline since it's simple enough to constrain dragging to a line. Then when a corner is hit it decides which line segment to move on based on the direction to the mouse.

    An alternate idea would be to find the closest point and the find the closest distance along the path, and have the object start moving in that direction.

    But perhaps the closest point is good enough. That involves finding the distance to all the corners and all the edges and selecting to closest one. The distance to the lines is the more mathy one.

    The absolute simplest way would be to put invisible walls around the path with sprites, move the the object toward the mouse with the "move at angle" action, and use the custom movement behavior's "push out" action.

  • I've yet to get a working solution to that. The idea is the ball can move in a narrow corridor and it tries to move toward the mouse, and it will slide against the walls.

  • It's HTML5 but not made with construct.

    [quote:fp8bbytk]... my first game created within Phaser ...

    http://www.html5gamedevs.com/topic/2510 ... ture-game/

  • Another idea is the curve looks to be an arc on a circle. Here's one idea to constrain the ball to that arc:

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

    /examples34/track_drag_approx.capx

    To make it perfect you'd need to tweak stuff. The radius, lowAng, highAng, the angle of the track and the origin of the track.

  • This was more painful to figure out than it should have been. You can change the css of the canvas to cover the page.

    "var style = document.getElementById('c2canvas').style;
    style.position='fixed';
    style.left=0;
    style.top=0;
    style.height='1in';
    style.width='1in';
    print();"[/code:33kajbrm]
    
    So you'd just change the canvas size and scroll before running that javascript code.  You'll want to restore the css values to what they were before after that.
  • The main way to get better at programming and math is by doing it. Any stuff you already know would help for sure, but there's also a wealth of information out there you can learn from: School, books, google, examples, tutorials, asking how to do something on the forum, ...etc. There's always something new to learn, and there's always stuff too advanced for your current ability that may be possible later after you know more.

    "floor" rounds a number down to a whole number. example: floor(2.5) equals 2.

    "cos" is a trigonometry function. Wikipedia probably has more information about it than you'll ever need. If you see it used then you just have to understand it's purpose in that case, aka ask the person that used it.

    "dt" is short for delta time, or the length of time of the current frame. Here's some good information on it's use:

    https://www.scirra.com/tutorials/67/del ... dependence

  • If the ground is just flat then the above still holds true. Just change velocity to velocityY and add a velocityX.

    When you launch from the cannon you have a speed and angle in mind so you set the velocities with trig:

    Set velocityX to speed*cos(ang)

    Set velocityY to speed*sin(ang)

    And add an event to move horizontally:

    Every tick

    ---ball: set X to x+velocityX

    This can get as elaborate as you add more features. I won't be able to explain it all. The physics behavior is there for a reason. It's probably better to use that for what you know.

  • Sure, here's all that's involved. The velocity increases or accelerates downwards, and the ball it moved by the velocity vertically. Then when the ball hits the ground the velocity is reversed and multiplied by 0.5 to half the next bounce height. You can adjust the gravity by changing the 1 to anything else.

    var velocity=0

    every tick:

    --- add 1 to velocity

    --- ball: set y to y+velocity

    ball: on collision with ground

    --- set velocity to -0.5*velocity

  • Without the physics behavior you could use the bullet behavior with gravity. Then when it collides with the ground use the bounce action and set the speed lower.

    You could go further by learning the math behind it. Some basic physics course should get you there. There are lots online. Or if you want a specific example there are a few you can find with a forum search.

  • I know you can check for collisions with the same type, but I always find it confusing.

    The condition is checking for overlap with the currently picked objects, not all of them. So the first condition picks all the left hand tiles. Then the next condition picks all the right hand tiles from the ones already picked, so the left tiles have no picked tiles to it's right so your result is expected.

    A solution is probably to make that event an or block and move the for each to a sub-event.