R0J0hound's Recent Forum Activity

  • It's drawing C2's canvas to a separate, smaller canvas which is used to save from.

  • You'll mainly be interested with the stopping distance which can be derived from this kinematic equation:

    vf^2 = v0^2 - 2*a*d

    where

    vf is the final velocity

    v0 is the initial velocity

    a is the acceleration

    d is the distance

    We want to know how far it takes to stop with a given speed and deceleration. So:

    speed^2 = 0^2 - 2*deceleration*distance

    solving for distance we get:

    distance = -(speed^2)/(2*deceleration)

    Note: if the value you use for deceleration isn't negative you can omit the minus in the formula.

    So then our pseudo code to move the object would be:

    if( speed < max_speed) then accelerate
    
    if( distance_to_target <= -(speed^2)/(2*deceleration) then decelerate[/code:bepp4si0]
  • Use this expression to get a smaller screenshot. Change w and h for different sizes.

    Browser.ExecJS("
    var w = 100;
    var h = 100;
    var c2canvas=document.getElementById('c2canvas');
    var mycanvas = document.createElement('canvas');
    mycanvas.width  = w;
    mycanvas.height = h;
    var ctx = mycanvas.getContext('2d');
    ctx.drawImage(c2canvas, 0,0,w,h);
    mycanvas.toDataURL();")[/code:6otna5an]
  • BSP's would need to be generated first but even then the drawing performance isn't there on my pc with html5. Also agreed a uniform grid would be faster, but it is also is less interesting.

  • Considering Doom and Wolfenstein 3D ran decent on computers with 1/100th the computing power of today's pc's I'd say some major bottlenecks are being encountered.

  • I didn't investigate it further but with my tests I was able to get away with using 1,2,3... for sid's.

  • You can look here for a few implementations:

    I have a computer that doesn't like html5 so the performance wasn't nice enough to pursue further.

    I've also made an attempt at 3d that leverages c2's renderer more using a plugin, but the z-sorting proves to be very complex.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One way would be to push the boxes away from each other and push then inside the triangle. To do it instantly you can put events 5 and 7 as sub-events of:

    Start of layout

    repeat 20 times

    or something like that.

  • I think it's a unique id of sorts, best I can tell it's used by C2 only when loading the capx. I was making an event sheet generator one time and just used consecutive numbers. I don't recall if anything amiss happened if they where omitted.

  • Your picking is good, it's just your equation and algorithm is off.

    First your qarp expression in event 10 is off. For the last parameter you're using timebetweennode/time which I believe should be flipped to time/timebetweennodes. Also I'd like to point out that expressions like Sprite(1).X will use the x of the sprite with the iid of 1 not the uid of 1, but in the case of your capx they happen to be identical.

    Fixing that you'll notice the path isn't smooth. Well it is until it hits the next node at which point the object jumps. You'll need to rework it.

  • It doesn't vibrate for me. In the capx I subtracted 1 from the repeat loop to stop jitter when the mouse isn't moving.

    repeat distance(cursor.x, cursor.y, mouse.x, mouse.y)-1 times

    Maybe that can help? Maybe use 2 instead?

  • To stop the cursor from clipping through walls you need to use a loop to check all positions between the old mouse position to the new position for a collision.

    like this or the attached capx:

    repeat distance(cursor.x, cursor.y, mouse.x, mouse.y) times

    ---- cursor: move 1 pixel at angle angle(cursor.x, cursor.y, mouse.x, mouse.y)

    -------- system: pick wall overlapping cursor.x, cursor.y

    -------------- cursor: move -1 pixel at angle angle(cursor.x, cursor.y, mouse.x, mouse.y)

    -------------- stop loop

    There are other ways such as doing a raycast from the old mouse position to a new one but c2 has nothing built-in for that. You could also do wall sliding for a more pleasing motion instead of getting stuck on walls, but again there's nothing built in to handle that.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound