Thread: HTML5 Games
View Single Post
  #2  
Old 05-01-2014, 08:52 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,365
IntoRain is on a distinguished road
Default

That's an amazing idea Kyttias! I have no idea about how to use HTML5 but I have made some games and I can help out if needed. I did a maze game in java including a manually-made maze and randomly generated mazes of different sizes, I can provide the code (it's a mess though :D). I will also be making a platformer game, no idea how it will end up, and I can also share that.

I remember that a few years ago when those card collection games were somewhat famous, most of the games available were memory games, sliding puzzles and jigsaw puzzles and they gave you rewards at the end, their code is somewhere around, if you need ideas for those.


Quote:
Originally Posted by Kyttias View Post
From those more in the know on Mysidia, some advice for currency integration would be nice. (I don't want 'give users a promo code for an item they can sell' as an answer.) I know I can pass a number as a variable from Javascript to PHP, it's the PHP code required to add that to the current user's current currency balance that I'd like some help with. So once I already have an amount I want to add to a user's currency balance held in a variable, how would I go about doing that?
The php part, I implemented AJAX's post method for user registration. It's black magic, basically. I don't remember it well, but basically

PHP Code:
$.post('/register/checkusername', {username:input},function(result) {
                            if(
result[0] != '0'){
                                $(
'.divUsername').html('<i>Username is empty or is already being used:</i>' input)
                            }
                            else
                            {
                                $(
'.divUsername').html('<i>Username can be used:</i>' input)
                            }
                        }); 
This is the ajax I used in the registerview.php. I'm sending the input and receiving the result. My username checking function is in the register.php file in the checkusername function, that's why I link to /register/checkusername. The result is actually the full php page including the result echo'd that I want, I have no idea why. But that's why I use result[0]

This is the checkusername function:

PHP Code:
public function checkusername(){
    
$mysidia Registry::get("mysidia");
    if(
$mysidia->input->post("username") == NULL)
    {
        throw new 
NoPermissionException("You specified an invalid action that cannot be completed.");
    }
        
$document $mysidia->frame->getDocument();    
        
$document->setTitle("error");
        
$username $mysidia->input->post('username');
        
$count $mysidia->db->select("users",array("uid"),"username = '{$username}' LIMIT 1")->rowCount();
        echo 
$count;
    } 
I sent input as username.

What I *think* you need to do is create a function in a file that receives the money and adds it to user's cash (mysidia->user->changecash(moneyToAdd)).
__________________


asp.net stole my soul.

Last edited by IntoRain; 05-01-2014 at 09:02 AM.
Reply With Quote