Molarmite Posted July 9, 2009 Share Posted July 9, 2009 I'm looking to make a slot machine with php. I have a general script but it's only one line and all text. I would like to know if it's possible to get pictures associated with each variable, and possibly see them spinning like a real slot machine or would that last part require flash? I'm just curious if it's possible to build a good looking slot machine before I advance any farther. My MSN is joli334@yahoo.com, my AIM is juicebox3313, either post here or it would be easier to send me a message on either one of those if you want to help. Thanks. Quote Link to comment Share on other sites More sharing options...
trq Posted July 9, 2009 Share Posted July 9, 2009 Anything visual needs to be done client side. eg; Html, Javascript or even flash. Quote Link to comment Share on other sites More sharing options...
Molarmite Posted July 9, 2009 Author Share Posted July 9, 2009 Which one would be the easiest? I wouldn't imagine that it would be too complicated graphical stuff. Quote Link to comment Share on other sites More sharing options...
trq Posted July 9, 2009 Share Posted July 9, 2009 If it where me, Id probably use javascript, the jQuery framework in particular. Quote Link to comment Share on other sites More sharing options...
Molarmite Posted July 9, 2009 Author Share Posted July 9, 2009 I'm not the most experienced at this, I don't mind reading a few articles to get this done. The main thing I'm wondering is, does this sound like something complicated? Hopefully it's something I can do as a beginner. <?php /* */ $faces = array ('Cherry', 'Bar', 'Double Bar', 'Triple Bar', 'Diamond', 'Seven'); $payouts = array ( 'Bar|Bar|Bar' => '5', 'Double Bar|Double Bar|Double Bar' => '10', 'Triple Bar|Triple Bar|Triple Bar' => '15', 'Cherry|Cherry|Cherry' => '20', 'Seven|Seven|Seven' => '70', 'Diamond|Diamond|Diamond' => '100', ); $wheel1 = array(); foreach ($faces as $face) { $wheel1[] = $face; } $wheel2 = array_reverse($wheel1); $wheel3 = $wheel1; if (isset($_POST['payline'])) { list($start1, $start2, $start3) = unserialize($_POST['payline']); } else { list($start1, $start2, $start3) = array(0,0,0); } $stop1 = rand(count($wheel1)+$start1, 10*count($wheel1)) % count($wheel1); $stop2 = rand(count($wheel1)+$start2, 10*count($wheel1)) % count($wheel1); $stop3 = rand(count($wheel1)+$start3, 10*count($wheel1)) % count($wheel1); $result1 = $wheel1[$stop1]; $result2 = $wheel2[$stop2]; $result3 = $wheel3[$stop3]; echo "Result: " . $result1 . ' ' . $result2 . ' ' . $result3 . "<br />"; if (isset($payouts[$result1.'|'.$result2.'|'.$result3])) { // give the payout echo "You won : " . $payouts[$result1.'|'.$result2.'|'.$result3]; } ?> <br /> <form method='post'> <input type='hidden' name='payline' value='<?php echo serialize(array($stop1, $stop2, $stop3)) ?>' /> <input type='submit' value='spin the wheel' /> </form> This is what I got so far. Let me know if it gets more complicated than this or not. Quote Link to comment Share on other sites More sharing options...
trq Posted July 9, 2009 Share Posted July 9, 2009 Complicated is a relevant term. I've no idea what your skill level is. Quote Link to comment Share on other sites More sharing options...
Molarmite Posted July 9, 2009 Author Share Posted July 9, 2009 My skill level is bare minimum. I know general stuff like how to make variables, if/else statements, echo statements, mostly just basic stuff like that. I know that I'll have some reading to do, but it would be nice to know ahead of time how much I will need to know. Quote Link to comment Share on other sites More sharing options...
trq Posted July 9, 2009 Share Posted July 9, 2009 but it would be nice to know ahead of time how much I will need to know. I'm afraid that question is impossible to answer. Answer me this: How long is a piece of string? Quote Link to comment Share on other sites More sharing options...
Eggzorcist Posted July 9, 2009 Share Posted July 9, 2009 You can just integrate the images with a simple html-based echo within your php, that would be by far the easiest. However, for a smooth alternative I'd use a javascript/ajax system. Also you may want to consider preloading all images or else it'll take too long to load them all. 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.