April Posted October 22, 2022 Share Posted October 22, 2022 (edited) Hello everyone! I have began general css and html work on a little pet project, a new one, and am making some progress. Super excited, but theres a few threads here and there that I keep getting snagged on. The biggest one at the moment is game currency. Going off one of the tutorials here, I designed the best way is to start with a login system and the game currency. Following that logically next would be a store, items, inventory, and then finally the pets themselves which are going to be the biggest obstacle. I have decided to use php and mysql, and have been slowly learning all about them. I have already researched login systems, and that should be easier to do as it has a lot of info online. However, currency systems in browser games are not as easy to research, so Im having a bit of an issue with them. Could anyone give me a little advice on it? And some links with resources? Thank you Edited October 22, 2022 by April Quote Link to comment Share on other sites More sharing options...
KingWigglett Posted October 22, 2022 Share Posted October 22, 2022 Hi April, Once you get your login system working and retrieving the user data (such as username) from the database, it should then be really easy to retrieve other information such as the currency. I'd suggestion creating your create account/login page first, because this will force you to implement your database connection which would be the backbone of all database communications. To start with that, your best bet to is to check out @judda's pdo wrapper here. It does alot of the legwork for you, especially with things like security and preventing SQL injection. 1 1 Quote Link to comment Share on other sites More sharing options...
judda Posted October 23, 2022 Share Posted October 23, 2022 @April You can consider the bank/current to be a lot like the user login system that you already built (most features end up following a similar pattern). Create a table (or just a field on the user's table) that will contain their current currency amount Retrieve the user's current amount of currency from the database Then whenever you are able to play with it / modify the value since it's been retrieved You should aim to have all interactions (removing/adding money) in their own helper functions so that you aren't removing it inconsistently, which will also allow you to add functionality like a transaction log could be easy to implement. I know I'm a little vague here, but let me know how we can help! 1 1 Quote Link to comment Share on other sites More sharing options...
judda Posted October 23, 2022 Share Posted October 23, 2022 Side Note: @April There are a few programmers in our Discord channel if you want to join there we can easily chat things through there too :D https://discord.gg/SZCGyaah Quote Link to comment Share on other sites More sharing options...
April Posted October 24, 2022 Author Share Posted October 24, 2022 22 hours ago, judda said: Side Note: @April There are a few programmers in our Discord channel if you want to join there we can easily chat things through there too 😄 https://discord.gg/SZCGyaah Ive been looking for a link to that, I will be joining. Thank you! Quote Link to comment Share on other sites More sharing options...
judda Posted October 24, 2022 Share Posted October 24, 2022 It was one of the things I forgot to add when re-installing. It's now in the header for everyone to join! Quote Link to comment 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.