In this post, I'm going to implement a reward system using PHP, similar to the current console generation's game achievements.
Certain user interactions which satisfy the game's predefined set of requirements will trigger an event of showing the reward.
E.g. Survive a fall from 400m will unlock the achievement of "Die Hard".
How to implement this feature in PHP? Since I've been working on CodeIgniter MVC, I shall introduce you a library, simply called
as "CodeIgniter Events" by
Eric Barnes and
Dan Horrigan.
Steps
- Download the latest CodeIgniter here, version 2.1.3 as of writing
- Download CodeIgniter Events library here
- Add the autoload line in
config/autoload.php
and put the events.php
in application/libraries folder
Tasks
Whenever user types more than 5 characters into a text field and clicks 'Send' button, it will trigger the event class and show the achievement text.
Solution
testing comments
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
DeleteThis comment has been removed by the author.
Delete