Timedoor Indones's Forum Posts

  • 9 posts
  • The core part is being able to slice a polygon by a line into two polygons. This can be done by calculating the intersection between the line and the edges, as well as finding which side of the line a point is.

    Here's one possible psuedcode of the algorithm to do it:

    for each edge clockwise
       if edge.point0 is on left side of line
          add point to poly1
       else
          add point to poly2
       if edge intersects line
          add intersection to poly1
          add intersection to poly2[/code:35epcbu6]
    
    Next we have the issue of drawing an arbitrary polygon and changing the collision polygon.  Vanilla C2 plugins won't help here.  I don't use it but the third party polygon plugin by yann probably could work since it both lets you draw arbitrary polygons at runtime and it makes it's collision polygon match.
    
    The rough psuedocode for that could be:
    [code:35epcbu6]get the list of edges of a polygon
    try to slice the polygon in two with a line
    destroy the old polygon and create two new polygons from the sliced polygons[/code:35epcbu6]
    
    Also on a side note you'll want to set the new polygons' velocities the same as the old polygon otherwise the pieces will go at a complete stop after slicing.
    
    At least that's a general idea how to do it.  There might be some issues that need to be ironed out, such as I don't know how well the polygon plugin works with the physics behavior.
    

    wow that a lot of explanation, thanks rojo

    i will look forward to try this

  • So i wanted to make a clone of this game : http://www.physicsgames.net/game/3_Slices.html

    someone can give me a hint how to make it works ?

  • Alrighty, this seems to be a tough one.

    Following paths from the pathfinding behaviour seems to ignore collision polygons.

    I figured that a way to fix this would be to add the solid and the push out solid behaviour to the red cars.

    The solid behaviour on its own doesn't seem to fix it.

    ok i'll try this.

    --- edit

    ok firstly i confused what do you mean by push out solid behavior. Google it, and found rex plugin, attach it and work like a charm. Thanks man!

    But just adding those two behaviors caused weird movement of the cars. I eventually learned that you added the solid behaviour to quite some UI elements.

    I don't know why you did that and I also don't know where that would be necessary, but I disabled those solid behaviours and that made the car's behaviours work and let them collide the way they need to.

    lol, i just thinking to make the cars still on the stage and not in the bottom of controller, so player can see.

    also not overlap the ui element on top. Any idea for this rather than using solid element ?

    Thanks

  • Could be an issue with the collision polygons.

    Anyways, to provide more help, we will need your .capx.

    (File -> Save as single file)

    hey randomly, thanks for reply.

    i have updated the start post.

    please check

    Thank you

  • Hi, i tried to make top down enemy chasing game,

    i stumbled upon a problem that if i insert solid behaviour, the enemy wont move

    if not this happen,

    how i can make this not overlapping ?

    any help are appreciated,

    Thank you

    DOWNLOAD CAPX:

    https://www.mediafire.com/?hsdec6ankafu9ah

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Make a new layer, put your ui on it, set the layers parallax to 0.

    after banging my head and looking, this option was there on left side lol

    thanks man it worked

  • Hey guys does anybody encounter this problem ?

    so i made "Scroll to X" game,

    and put UI on top

    but UI is wiggling like this.

    The top behavior only anchor,

    the scroll to is controlled by system action.

    any help are appreciated thanks

  • This score is saved in a database? If Database is a bit more complicated.

    If only locally then you should use storage location.

    You can use variables to determine the name of the storage location of the score.

    So users can change easily.

    https://www.scirra.com/manual/188/local-storage

    hi martdsam, thanks for your reply

    the thing is, the score database is in their server, and no way i get access to it, im selling my games to different arcades owner, so it should be more flexible way.

  • Hello fellow construct 2 user,

    so the idea is, im selling my games into some arcade,

    usually on my past game, im using a variable on index.html (example: BACK_URL) and then

    on the game over screen i just load that variable and send player last score to their arcade store back url (using javascript windows.location).

    with this method, buyer can easily changes only index.html, without touching sources.

    problem is, how do i achieve this with construct 2 ?

    any kind of suggestion is appreciated

    Thanks

  • 9 posts