R0J0hound's Forum Posts

  • 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.

  • Maybe scroll to the point you want to rotate from, rotate, then scroll back. It may not work if the engine waits till the next frame to apply it. I haven't tried it though. Worst case you'd just not use the layer rotaion feature and rotate like newt suggests.

    More general control for layers would be welcome. Instead of the parallax controls I wish layers could be moved, rotated from any point, scaled from any point X and y, and why not, skewed from any point. All those are affine transformations and it would make you and I happy to have.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Force own texture" draws the layer to it's own texture first as opposed to directly to the canvas. For it's uses do a forum search for it for lots of examples.

    Also here's an example of a continuous blob.

    https://dl.dropboxusercontent.com/u/542 ... 0blob.capx

    It's not really trig, it's more just interpolating between the old and positions of the mouse and setting the size accordingly.

    Notice when moving fast you can see the polyline path of the mouse. It can be made smoother by using a cubic interpolation between the points. However, I haven't the time to do it today.

  • johnkx

    It should work. The paster object should default to being completely transparent. If not you can clear it with an action. After that any transparent Sprite should be able to be pasted in as expected.

  • Put all the objects in one layer and give the layer that effect. You may need to set "force own texture" to true.

  • johnkx

    As I recall I didn't add an action to load an image into paster. You can paste objects to it, and then it should save with the paster.imageUrl expression.

  • You can access other instances by iid with sprite(i).x, where i is an instance number. I guess you could make a helper function to pick the instance by a variable and return the iid. I'd just change your drawl one function to take the variable values and do the picking inside the function.

  • I haven't opened the capx, and I skimmed your post. It sounds like the question is how objects are paired when when no picking is done.

    Take this event as an example that does that pairing when there are multiple instances of sprite1 and sprite2.

    Every tick

    --- sprite1: set position to Sprite2

    That is equivelent to the more verbose event here:

    Repeat sprite1.count times

    Pick sprite1 instance loopindex

    Pick sprite2 instance loopindex%sprite2.count

    --- sprite1: set position to sprite2

    You can replace count with pickedCount instead and that will show what's happening when only some of the objects are picked. Anyways I hope this helps, I thought it was cool when I realized it. If I completely misunderstood then I'll be sure to look at the capx and Re-read your post when I get a chance.

    Cheers

  • I haven't looked at your capx but images aren't saved. You can however keep the image URL in a variable and then load that URL every time you load.

  • The "pick closest" object condition does that.