Hello RaGEZONE, I made a quick little PHP text/numbers game that could be used to pass the time.
Mostly wanted to brush up on a few techniques.
You can play it here,
http://ninja.wysgui.com
You can either log in as one of the bots, 'bot1'-'bot5', or you can create an account.
You get stats by attacking or defending- and winning.
It's a tiny game without much purpose, but it was fun to make
Using Items (Player)
Items are used to increase some of your numbers. Well, put creatively, they're used to either heal stats, or increase available stats. Each item costs cash, which can be earned by attacking and knocking out other players while winning the final attack. It's not as easy as it sounds. As a player's health gets lower, you can't hit as high. You can only win if you hit harder than your opponent.
Creating Items (Developer)
There's a one-step process to creating items, and it involves PhpMyAdmin.
- Go into PhpMyAdmin, click on the "items" table, and click the tab "Insert"
- Ignore the id field.
- Put the unique name of the item in the value for "name"
- Put a description for what the item does.
- Put the cost for the item (how much cash it takes to buy).
- (The Hard Part!) The field from 'players' table that gets increased. (Such as "total_health" or "remaining_health", or even "cash", if you want to give away free cash.. DO NOT put data such as: "id", "timestamp", "user", "pass" and "email".)
- Enter how much is added to the field from 'players' [This system only supports static addition, rather than dynamic mathematics]
That's It! Insert the row, and the engine will do the rest. Players will be able to buy any item if they have enough cash to cover what you enter in "cost". When they buy it, the column you enter from "players" table, is used to give the player the "boost" they paid for. The row you enter is (in many cases) case-sensitive, so should always be lower-case. It must completely match the name of the column in the "players" table, or a mysql error will be thrown at the event that item is purchased. If you use a field that is not an integer, than problems happen too. So be careful, but have fun ;)
Edit: Released.
ninja.zip is the basic one-page set-up with no items.
Features:
- Uses a system for simple, secure includes.
- You can register an account which starts you with 25 of each: "health", "strength" and "defense".
- Password is stored as md5.
- You can attack other players.
- If you win, you get experience.
- You can add comments.
Edit 2: Released ninja-2
*Comes with all the great things the other one has.
Changelog:
- Separated things amongst pages,
- Added "cash" field in table: "players"
- Added "items" table
- Added some sample items (the items table works pretty strict)
- Added a script to sim_attack() function which adds cash when you win and knock your opponent's HP to zero.
- Cleaned up a few things, might be buggy though..



Reply With Quote


