How do I split an object?

0 favourites
  • 2 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I am building a game that has automatic dungeon building and it is programmed to place walls and then doors on top of walls. My current programming objective is to have the game automatically split one wall into 2 walls when a door is placed in the middle of a wall. Any suggestions? I have tried to code a solution, but the solution only works when the angle of the door and the wall is 0 degrees. If anyone could help to make this able to work at any angle, that would be appreciated. Screenshot of the current code below:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nevermind. I searched online for a while and found a solution using trigonometry.

    x-x1 = d*cos(a)

    y-y1 = d*sin(a)

    d=distance and a=angle

    I applied these equations to my project and the door split the wall every time no matter the angle. For the coordinates, I ended up using the polypointXAt and polypointYAt methods from the collision box.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)