Attach sprite to another sprite

Hi,

I’m making a game that teaches the player how to turn uranium into reactor fuel or a fission bomb.

I’m working on the mining mechanics to begin with.

I have a container with a Pickaxe sprite and a small rectangle I’ve placed on the edge of the left blade to mark where I want the pickaxe to strike the mine wall behind it, which I’ve called the strike point.

Clicking rotates the Pickaxe -45 degrees to simulate a down swing.

The idea is when the Pickaxe is swung, the coordinates of the strike point are used to determine where the mine wall was hit (and where to add some animation of rocks breaking off the wall).

To test its accuracy, I’ve added a rectangle in the exact center of the canvas. When I “swing” the pickaxe and have the strike point hit the centered rectangle, the coordinates are all wrong.

pic1

pic2

Demo: http://jamesbailey.uk/games/test/

Source: http://jamesbailey.uk/games/test/mining.zip

Any help would be appreciated, thanks.

Edit: The coordinates are displayed in the console.