zorro2b
zorro2b

Reputation: 2257

How to combine images for sprite kit node

I am learning sprite kit by writing a lunar lander style game. The lander has a main thruster at the bottom and left and right thrusters. To show these on screen I can change the texture on the node to one that has an appropriate combination of thrusters. Using this approach I end up with images like lander-thrust-none, lander-thrust-main, lander-thrust-main-left etc.

Is this the best way to do it?

Is there a way to programmatically add in the thrust images to the image of the lander?

Upvotes: 0

Views: 460

Answers (1)

hamobi
hamobi

Reputation: 8130

the best way to do it would make a lander sprite sprite without any thrusters. then you'd have separate images for the things you need to change (thrusters, whatever). add those images as children of the lander sprite. then just position and change those images as necessary. It might be easier to access these child sprites if you make them properties of a "Lander" subclass.

Hope that helps.

Upvotes: 1

Related Questions