like to create a game like Last Knife and Knife Hit . Are there any example I can refer to? Please help me!
Let’s break down the game:
The thing in the middle is a game object with a sprite and a collision object (red). It is rotating according to some pattern. For now it can be simplified to:
go.animate(".", "euler.z", go.PLAYBACK_LOOP_FORWARD, 360, go.EASING_INOUTQUAD, 2)
The thing in the middle can have apples parented to it. The apples are game objects with a sprite and a collision object (yellow).
The knife that you are throwing is another game object with a sprite and two collision objects (red and green). The green collision object at the hilt of a knife is designed to mask against the collision object on the tip of the knife and it starts disabled (grey) when thrown. The red collision object at the tip of the knife is designed to mask against the hilt of a knife, the apple and the thing in the middle.
When a knife is thrown it is animated to the centre of the thing you are about to hit (using go.animate). When you get a collision response you check if you’ve hit the thing in the middle (red), an apple (yellow) the handle of another knife (green).
If you hit an apple you delete the apple and award score.
If you hit the thing in the middle you cancel the animation, disable the collision object at the tip and enable the collision object at the hilt of the knife. You also parent the knife to the thing in the middle so that it starts rotating with it.
If you hit the hilt of another knife it’s game over.