Gameplay Coding: Part one
We need to make on start of layout if the rope is overlapping rope and they have the same ID (that what is used for) make a revolute joint from Wheel’s image point 1. That should loop for each rope so it can be attached to its own wheel.
Then we add that on start of layout if Cheese is overlapping rope and they have the same Id, the cheese pin to rope’s angle & position.
Since “wheel” , “rope” ,and “cheese” are overlapping they have physics behavior, they will push each other which will make a huge bug that will ruin gameplay, we will disable collision between them.
Now it’s time for slicing logic for cutting rope (also can be used for fruit ninja game! Yay!)
When touch is on touch and the mouse is visible, create a slice at layer 1 and position touch.X & Touch.Y.
To delete slice trace we use that when slice is created after 0.2 sec delete a slice.
We add everytick set slice angle towards position Touch.X & Touch.Y
Now we need to cut the rope! So we add that if slice is overlapping Rope & background and its count is equal to 5 or greater destroy “rope” & unpin “Cheese”
When the cheese collides with stars, destroy stars & add 1 to mouse.stars_collected.