Jump to content

Help switching from object-oriented mindset?


bearkin333
 Share

Recommended Posts

Hello all, I'm working on a little pet project of mine called Whitesmith, and I've run into kind of a major stumbling block. A big part of the game are craftable weapons that the player can equip. The last time I was coding, I was using C++, and now I can't picture a way to implement the weapons without using some kind of object. I've considered extending the Sprite class, but that seems unwieldy for what I'm trying to use it for.
Any assistance with this would be greatly appreciated.


--Cary Reese

Link to comment
Share on other sites

A sprite is just one representation of your game object. So instead of coupling it to the weapon itself, why not just create a brand new object for your weapon? and then add a sprite as one of its member variables to represent it? 

 

This would give you the flexibility of say using multiple sprites should you want to represent your weapon that way. Or maybe using text if you want to render your game in a console. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...