lukezero's Forum Posts

  • You do not have permission to view this post

  • Have you tried Paster plugin? It's similar to Canvas, and as far as I remember, it works well when pasting on every tick.

    Also, try moving the pasting events to the bottom of the event sheet.

    Thanks for the tip, dude. :)

    I'm trying the Paster plugin since yesterday. Soon I think I'll have some good news. ;)

  • > By the way, I'm using Construct 2.

    You should've mentioned this in the subject. Canvas in C3 works completely differently.

    I managed to put almost the entire routine in C2. The problem with this example is that it is applied to each object. I don't know if it can be adapted to layers (which is what I'm currently using). As I said, my biggest problem now is flickering on the Canvas.

  • Check out this example

    https://howtoconstructdemos.com/create-a-reflection-with-water-effect/

    Thanks, dude. :)

    This is a great solution for a mirror, not a river or sea, as it is a large routine focused on just one object (the player character, for example).

    I actually got what I wanted, but I would like to not have the flicking in the reflection. :/

    By the way, I'm using Construct 2.

  • Hi guys!

    One stage of my game has a river crossing and I'm using Canvas to create the reflection. However, Canvas doesn't run smoothly, it flickers all the time. I've tried updating variations with "Every" or any other value, but to no avail.

    I've also activated "Force own texture" for the layer and left Canvas only in the canvas area instead of the entire stage.

    I'm using the following routine in Canvas:

    Does anyone know how to make Canvas reflect smoothly?

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

    Ok, dude.

    Thanks one more time for your time and collaboration. :)

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

    It still doesn't work. :(

    Whenever the enemy stands still in front of the player, the twelve objects accumulate in a single coordinate and I would actually like the objects to always maintain a distance between them in a straight horizontal line, forming a kind of "Chinese serpent".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

    Your routine works very well! I've already implemented it here! :D

    My only problem is that the objects can't maintain a minimum distance between them, always coming together at a coordinate (that of the head, since they all follow it) when the head stops.

    Sorry to bother you again, but do you know how to fix this?

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

    Sorry about that, but I was desperate.

    Thanks again for the great help! You're the man! :D

  • I'm almost there! :D

    I completely forgot to assign ID values ​​to the enemy's head and tail.

    I did this with the vertebrae in the loopindex, but I had forgotten about the extremities (head and tail).

  • R0J0hound Master, do you know what is happening here?

  • Now I tried using Array, but it didn't work. The head goes to the top left side of the screen and the vertebrae to the bottom right. I don't know what to do anymore. :(

  • Since I'm a designer and not a programmer, I've been using AI to program, but I still haven't been able to get a functional routine in C2. :(

  • Thanks, man. I know that behavior. I already test it, but unfortunately it didn't worked. :(

  • Sorry, dude. I use C3 too, but in truth I just have the C2 license. I tried to implement your routine on C2, with some change (due to Follow absence), and it wont worked. :(