cooldude832 Posted October 19, 2007 Share Posted October 19, 2007 I'm making a game that is a turned based game in which you move around the map by clicking a direction and it refreshes the page with your new position. All the character data be in mysql, and i'm wondering if OOP makes more sense for this than just functional stuff. Quote Link to comment https://forums.phpfreaks.com/topic/73993-should-i-use-oop-for-this/ Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 If it's going to take a large amount of code, I would use OOP just because it makes it so easy to sort everything. I don't have much of anything intelligent to say as to why it's better to use OOP in this case. I just like using it when I'm programming something that could get confusing, and OOP takes all the confusion out. Thats just my two cents. Quote Link to comment https://forums.phpfreaks.com/topic/73993-should-i-use-oop-for-this/#findComment-373502 Share on other sites More sharing options...
cooldude832 Posted October 19, 2007 Author Share Posted October 19, 2007 to me oop confuses it to me, but I can see some advantages, because the character becomes an objects in which its position, health, power, defense etc are all $this -> $var but I just like to write $char['hp'] . My idea is a turn based attack game. Quote Link to comment https://forums.phpfreaks.com/topic/73993-should-i-use-oop-for-this/#findComment-373504 Share on other sites More sharing options...
pocobueno1388 Posted October 19, 2007 Share Posted October 19, 2007 Well, it's ultimately your choice. If it's not going to take tons of coding, then you probably shouldn't worry about using OOP. For a game like your doing, you could make it so you can use each function within the class work on both players. Without OOP, your going to have to have two separate parts of code for that. My choice would be to use OOP just because you are going to reuse each function more than once in your script, so it will greatly reduce the amount of code. Again, I'm no professional with OOP at all. So if you want to wait for a second opinion, that would probably be smart. Quote Link to comment https://forums.phpfreaks.com/topic/73993-should-i-use-oop-for-this/#findComment-373513 Share on other sites More sharing options...
Ninjakreborn Posted October 20, 2007 Share Posted October 20, 2007 I guarantee you taking the time to learn OOP and implementing it in your game will save you HUNDREDS of hours later on down the road. The development will take longer if you are starting out but once you learn the time spent later on down the road cutting down on development time, making it easier to make code changes, and making new feature enhancements will literally triple in speed if programmed right. Quote Link to comment https://forums.phpfreaks.com/topic/73993-should-i-use-oop-for-this/#findComment-373627 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.