R0J0hound's Recent Forum Activity

  • The 14.2 mb is the compressed png size. That should remain the same which means faster downloads. When the game runs, the images need to be decompressed to use.

    45*650*540*4 =~ 63.2 mb

    Depending on the hardware texture sizes are only power of two so 650x540 may have to take up 1024x1024 which would give:

    ~188.7 mb

    Also keep in mind there will be other memory usage needed for the renderer in general. I think Ashley made a blog about it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Self.x+dist*cos(ang)

    Self.y+dist*sin(ang)

  • A few ideas:

    Since you’re hitting the limit of the algo that the canvas object uses to convert a concave polygon to multiple convex ones, you could feed your polygon to another js library to do that and just draw the list of convex polygons it generates.

    Also as a tangent you could use a mesh distort to render convex polygons.

    For example for a 100 point polygon you’d do it roughly by:

    Set mesh size to (50x2)
    Repeat 50 times
    — set mesh at (loopindex,0) to point(loopindex).xy
    — set mesh at (50-loopindex-1,1) to point(50+loopindex).xy

    And actually you aren’t limited to just convex polygons. In general you can do any triangle strip in this way which includes some concave polygons. Also if you adjust the uvs you can get a textured polygon without using blend modes, but I guess that’s unrelated to what you’re doing.

    Anyways, the idea to explore is convert any polygon to multiple triangle strips and use mesh distorts to display them. To do that you’d slightly modify a triangulation algorithm like “Ear clipping”, which basically adds triangles at convex points if no other points are inside that triangle. To make it generate triangle strips instead of just triangles you’d zig zag moving cw then ccw on the plolygon when adding triangles.

    Alternatively you could triangulate, then merge triangles sharing edges if the result is still convex.

    I’ll be attempting to make an example of the idea when I get time.

  • Almost there. You need to click on one of the sub forums first.

  • That’s all I have at the moment.

    The array is a history of the positions of the head which basically can be thought of as a polyline. You can move along the polyline by a specific distance. A simple starting point would be to move a distance along a single line segments. Anyways, many path following examples do that.

    Another idea is to just move each section toward the section ahead of it till they overlap.

    Just some ideas. I won’t be making any examples any time soon.

  • You could change it to only add points to the array if the head is moving instead of every tick. Basically:

    Compare: distance(head.x,head.y,array.at(0,0), array.at(0,1)) > 0

    That would keep it from stacking on top of itself if it stopped. Possibly good enough.

  • You could also have the function return nothing and set some global variables instead that you’d use after calling the function. For example:

    Global number retx=0
    Global number rety=0
    
    Function rotate90(x,y)
    — set retx to -y
    — set rety to x
    
    Every 1 seconds
    — function: rotate90(sprite.platform.vectorX, sprite.platform.vectorY)
    — sprite: platform: set vectorX to retx
    — sprite: platform: set vectorY to rety

    You can do that with anything. Instead of returning a value you just save the result somewhere. Or if you want it to be more dynamic you could say, create an array, fill it with values and return the uid of the array. There are tradeoffs for readability and ease to use though.

  • Hi,

    No need to ever tag me. I don’t look at alerts and I skim over all the new posts when I visit the forum.

    I’m guessing you’re trying to do it by moving the head and having it leave a trail that everything else follows. One way to do it is add the head’s position to the front of an array, and just always position the body parts from an offset in the array. Finally you’d want a way to remove stuff off the back of the array when it gets too big.

    The main complexity here is the offset calculation. A simpler formula could be (self.iid+1)*30 to just have each part be 30 frames (or 0.5 seconds at 60fps) behind the part before it.

    (self.iid+1) gives 1,2,3,…etc
    (self.iid+1)*32 gives a distance of every 32 pixels: 32,64,…etc
    (self.iid+1)*32/100 if the head always has a speed of 100 this converts the distances to times
    (self.iid+1)*32/100*60 Finally this converts the times to frames. 

    So events would look like this

    Start of layout
    — array: set size to (0,2,1)
    — body: set offset to (self.iid+1)*32/100*60
    
    Every tick
    — array: push front head.x
    — array: set at (0,1) to head.y
    — body: set x to array.at(self.offset,0)
    — body: set y to array.at(self.offset,1)
    
    Array.width>6000
    — array: pop back

    You’d just move the head however you like. And at 60fps and the head moving at 100 pixels per second the body parts would be connected. There are likely many improvements to this idea but that’s the simple gist.

  • Without a layer you could draw them to a drawing canvas at 100 opacity and then make the canvas have opacity.

  • Probably add a “for each mover” condition to the top of that event.

  • The pin lag has to do with the order the pin behavior runs among the instances. As you’ve noticed moving the object types around in the project folder can change the order of things but I wouldn’t consider that a great solution.

    However if you wish to solve it that way you probably can come up with a strategy. I’m guessing the object types list is ordered alphabetically. I’d imagine folders just are expanded in place so that would allow changing the order in that way.

    The second part would be to find an order where the lag doesn’t happen in specific cases. Depending on the pin configuration you may or may not be able to solve the lag in this way though, or at the very least you’d only be able to solve lag in a specific chain of pins I imagine.

    Alternately I’d just do the pinning in another way besides the behavior so that you’d have more control of the order of things. That could be wackyToasters suggestion or just setting the position somehow.

  • It’s probably easier to just use smaller images and more compressed audio and just let construct handle the loading.

    Construct’s docs say it loads images layout by layout, and audio is loaded as it’s used.

    My guess is what the loader does automatically is load the layouts and events data (which is very small) then loads the image files and maybe audio files, and then when changing layouts the textures are loaded/unloaded from video memory from the images.

    Anyways I guess one strategy would be to make all the animations use tiny images and load bigger images yourself from the files folder (which isn’t automatically at all).

    Overall it seems tedious to side step construct’s loading to do your own. Maybe do some tests?