R0J0hound's Forum Posts

  • To make the preset you could make a utility capx to fill in values in the array then save it to a file with the download action. Add that file to your project and load it with the AJAX object and the array load action.

    There are also a few 3rd party plugins that allow loading other file formats such as csv.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I made some some boid examples here:

    http://www.scirra.com/forum/boids-tests_topic59833.html

    In the third example I used the function object to add all the vector operations and used an array to store all the vectors. I then made any variable be a vector by storing an index of the array, and only modifying the variable with the functions.

  • If you calculate what the speed will be after applying the impulse, then you can compare the current speed with the calculated speed.

    If either of these is true then apply the force:

    +calculated speed<max speed
    
    +calculated speed>=max speed
    +calculated speed<current speed

    To calculate the speed take the same value used for applying impulse and do this:

    vx= self.Physics.VelocityX+IMPULSE/self.Physics.Mass*cos(self.Angle)

    vy= self.Physics.VelocityY+IMPULSE/self.Physics.Mass*sin(self.Angle)

    calculated speed= distance(0,0,vx,vy)

    I made my own capx to figure out a solution so here it is for a working example:

    http://dl.dropbox.com/u/5426011/examples16/spaceship.capx

  • A sprite and an array in a container works for this. Here's an example:

    https://www.dropbox.com/s/lipjb22xahgej ... .capx?dl=0

    Notice that only two events are used for the recording and playback. The rest are just standard game events.

    This idea can be extended by adding some interpolation between recorded states to smooth out hiccups caused by garbage collecting or other programs running in the background.

  • Paradox

    Here's an updated example that positions the handles correctly when rotated.

    /examples16/resize2.capx

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

    You can right click anywhere to do rotation and I eliminated the need of an array.

  • Certainly, you can use it. Most, if not all of the capx I post are free to use.

  • boolean

    Since no picking occurs in your example you can do it with:

    System compare (a=b) | ((b=c) & (c=a)) = 1

  • Here's one example of followers in a platformer. It saves the players position to a queue and positions the first follower to say 10 positions ago, the second 20 and so forth.

    http://www.scirra.com/forum/eek-slowdown_topic46528.html

  • Yes, it changes the size of the canvas texture, the image itself is discarded.

  • According to this:

    http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference

    All numbers in javascript are 64bit (or take 8 bytes).

    A megabyte is defined as 2^20 or 1048576 bytes.

    So you can calculate the memory used in megabytes with:

    100000 * 8 / (2^20) = 0.762939453125 mb

  • The solution I had in mind was proving to be too complicated, but here is another solution that doesn't use any third party plugins.

    http://dl.dropbox.com/u/5426011/examples16/inf_map3.capx

    The idea is save a bunch of random numbers in a big array at the start of the layout. Then using an formula like Array.At((x*23+y*5)%Array.Width) you can get a random number for any position on the layout. The 23 and 5 are arbitrary and can be any value.

    The main drawback is this method does create a pattern that is noticeable when the array is small.

  • With seeded random I can calculate the same value every time for a square so I don't have to store the random values in an array.

    For regular random you would need an array to store the random values to interpolate between. I've yet to work out how it would be implemented exactly.

  • sqiddster

    A large array shouldn't be too much of a problem as most computers have a lot of memory.

    I tried out seeded random using the RandomPlus Plugin and here is the result:

    http://dl.dropbox.com/u/5426011/examples16/inf_map.capx

    If you're doing a scroller that goes in only on direction you could use the standard random, but store the values until they are no longer needed for interpolating.

  • Using a large array is an option, it will provide persistence. Shifting the array is another option but you won't be able to use for each xy element. You'll need to set the array in a certain order depending on which direction you shift. For example shifting right:

    for x from 32 to 0

    for y from 0 to 32

    -- set array(x,y) to array(x-1,y)

    A third option that would provide for persistence and and infinite size would be to use or implement a random function that allows you to set the seed.

    One example of this would be Perlin Noise

  • "unload layout textures" still works for images loaded at runtime, but the texture has to have no objects using it. If you loaded the images into a tiledbg instance, you need to destroy that instance before the image can be unloaded. If using sprites to store the loaded textures, then you will have to destroy all the instances of the sprite before it can be unloaded, or just load a small image into the frame you wish to remove.