(Solved) In the Gdgames there is a game Raft i saw that the fence connects in every direction?

In the Gdgames there is a game Raft i saw that the fence connects in every direction i have been trying to do that but haven’t been able to
So can someone tell me how to do that?

Which one? Did you mean the infinitely scrolling top down background example?

If so, which part are you having trouble with? If you look into the events sheet, there are comments to help understand what’s going on.

I believe the relevant parts would be that the background is placed on a separate layer from the base layer where the character is. Then as the comment on the event sheet states, the modulo expression was used to change the position of the camera on the background layer.
If this wasn’t what you’re looking for, then please ignore this reply.

No not background
the FENCE in game mechanics it connects to other fences

Well, I’m afraid I don’t really know which game you’re referring to. But if it’s about connecting stuff, then perhaps this other post might help:

If it’s still not what you’re looking for, then I’m sorry I couldn’t be much help.
Let’s wait for someone more knowledgeable.

so like in this image the player has placed fences X axis but then when it places on Y axis the point where two fences meet it changes i am trying to achieve that

You mean something that is called AutoTile


Well, if that’s the case, I do believe that post I shared earlier about how to snap objects would likely be worth a look. It uses the rectangular grid extension. I’d imagine you can set up an event where it would detect adjacent fences when placing one down on the grid and it would change the animation of the fence accordingly.

Off the top of my head, it might go something like this:

Create a dummy fence object that can be dragged about.

If dummyfence is being dragged: snap to virtual grid.
check if there is a fence 90 degrees from dummyfence that’s less than, idk… 8 pixels distance?
Then set a variable. f90deg or something.
Check also in the other directions with a corresponding variable for each.

Then set a number of events which will account for the variables that have been set.
If f90deg is true and f180deg is true: change animation of dummyfence to that type of fence.
Then when mouse is clicked, new fence object is created with the same type of animation as dummyfence.

dummyfence will then be hidden or deleted when it’s done.

Mind you, I’m not very experienced with that extension but I imagine, yeah, something like that.

that’s exactly what i want!!!

I have done the snapping in grid part i am going to try the rest then reply again…

so i tried the extension and for some reason it is not working

i tried it is not working

So, I experimented with the example game for a bit and made some modifications.
What I did was create a “Link-bubble” object.
The bubble object would have four “connector” objects. One for up, down, left, and right.
These connectors would move together with their parent link bubble.
They are to be set as hidden in the final version of the game.
Whenever a connector collides with the connector of another link bubble, it would set a corresponding boolean variable to true.
Then the animation of the link bubble would change depending on which variables are true.

I’m no pro and it’s pretty messy. lol. But hopefully someone with a better method might come along and show us, that would be great.

It’s okay lol i don’t know much either
i found an extension it is working so far

1 Like