R0J0hound's Recent Forum Activity

  • every 4.0 seconds

    for each enemy

    --- create bullet at (enemy.x, enemy.y)

    --- bullet: set angle to 90*int(random(4))

  • Zebbi

    To do it without the paster object just make sure the areas on either side of the layout look identical.

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

    /examples31/loopScroll.capx

  • sweet

  • SamFisher

    The linear damping property can be used to give an object drag so it falls slower.

  • I didn't mean those games specifically, I just mentioned them because they run into the issue with floating point numbers.

    Basically floating point numbers are stored like this fo example:

    1.234 *10^10

    Two numbers are stored. The significant digits and the exponent.

    So just for example say it only has 4 significant digits and a two digit exponent you could represent various numbers like this:

    10 = 1.000*10^01

    192 = 1.920*10^02

    1,000,000,000 = 1.000*10^09

    Etc.

    The result is you can represent a wide range of values but the limitation is the numbers further from zero are further apart. Or in other words, there are more values closer to zero.

    For example take 10,000

    1.000*10^04

    The next higher number is 10,010

    1.001*10^04

    So with a number that big the closest another different number can be is 10 away. And the distance only increases with bigger numbers.

    Now the actual floating point format uses 15-17 significant digits, but in a similar way the differences from one number to the next increases at extremes.

    To fix the object distortion subtract the ships position from everything to shift toward zero so the the corners of the object's quad can be placed with higher percision.

    As your ship nears the edge of the Galaxy (maximum 64bit floating point number) you'll run into another similar issue. The ship with no longer be able to move by small steps, instead it will jump by larger and larger steps until either a position of infinity is reached or the step exceeds the velocity, at which point the ship will stop moving.

  • C2's expressions only support numbers and strings so that's all you can return from a expression function. The variadic presumably mean either a number or a string.

    Any JavaScript object can be converted to a json string. I don't recall offhand but It's done with a function built in to js. A Google search for converting an object to json in JavaScript should give you that solution.

  • I haven't had a chance to run the capx but just to hazard a guess you're probably running into a percision limit for floating point numbers. Aka after a point tiny changes to giant numbers are rounded off. A Google search for the details of floating point numbers will give lots of interesting stuff on the subject. Typically space games or game with huge worlds like minecraft work around this keeping numbers closer to zero and shifting the position of stuff around. In the case of your super high speed I'd just scale all the numbers down. I mean speed is relative and you don't need to use actual units.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • irina

    yeah, I just updated the link.

  • damjancd

    Try the link again. I think I haven't been considering object recycling when the instances were destroyed. now it discards the references to the textures/canvas' when an instance gets destroyed. If that doesn't work then I'm at a loss.

  • The two ways I've used to do that are either:

    * move the player if he exits either end of layout. Scrolling is unbounded and the seam is hidden by either carefully placing objects in the same places on either end or using the paster object to copy the other side. It just to make the transition appear seamless.

    * move everything under the player instead of the player. And just wrap the pieces as the leave the layout.

    Both those take care of the visual portion. The seam will be a problem with ai and such so you'll have to take that into consideration with your events.

  • The reason something like a beach ball is floaty is because of air resistance. With the physics behavior or even with most simulators in general it's like objects are moving through a vacuum, in which case nothing would be floaty.

    Now the solution is to apply a force proportionate to the object's speed in the opposite direction of the object's motion. Basically we're adding a drag force.

    The following would do it, just tweak 0.1 till the object has the desired floatiness.

    every tick

    --- apply force -0.1*distance(0,0,Self.Physics.VelocityX,Self.Physics.VelocityY) at angle angle(0,0,Self.Physics.VelocityX,Self.Physics.VelocityY)

    EDIT:

    or alternatively you can look at the linear damping property.