Where 'AFD' is the name of whatever .wav sound you want to play for your April Fool's Day joke. Then embed the Flash file somewhere on your web-page, with small height and width arguments, or hidden with a CSS trick, or buried behind an image - whatever it takes so the user cannot possibly find it to shut it off!
After a few false starts on this, my most ambitious Blogsquares Flash item yet, it's time to turn it loose. So, look for a video poker game down there in the sidebar on this blog.
It's a simulation of the video poker variation known commonly as "Jacks or Better". I followed the example in Wikipedia for the pay table, so it should have the same theoretical return of 99.54%.
Of course, in typical rounds of play, it will usually gobble your 100 credits within 30 plays or so, with a few hits of pairs and three of a kind in the mix. Having lived in Vegas and having experienced the average video poker machine on the average casino front on Freemont Street, I am reasonably sure that it plays like the same thing. When the credits reach zero, the only way to reset it is to refresh the page!
As always with gambling games, I must state that this is an entertainment device only.
And my conscience won't let me post a gambling simulator without pointing out that gambling for real money in real life is, point blank, a stupid thing to do, and should only be approached after a thorough mastery of probability mathematics has been undertaken and then only in the spirit of research. Casinos do not make money when you lose; they make money when you win, and they do that by not paying you the winnings you're entitled to for beating the odds you just beat.
That's enough being Mr. Heavy. Have fun, and report glitches and bugs in the comments!
Note, however, that the card graphics are just suits and ranks. I did that to have them be small and yet readable, with an eye towards making a BlogSquare-sized Poker game for the sidebar later. If you want bigger, better cards, Wikimedia Commons has a whole playing-card category, to say nothing of the deck graphics that come with KDE and Gnome card games which should be reusable.
This is one of those classic "should be solved only once" type problems. So now everybody has a deck of cards and a way to shuffle them already pre-built for open-source Flash development, all you have to do is write the game around it. The code isn't brilliant or elegant, but "stupid and robust".
One note about the code that needs explaining: Actionscript uses zero-indexing when creating an array. But SWFTools doesn't seem to allow a "frame zero"; sprites have to start with 1. So I create the Actionscript arrays with an extra space at the beginning (NULL or 0) to avoid having Card_Value[x] correspond to card frame x-1.
Every now and then, playing with Flash animations is an itch I've just got to scratch. This time, I looked back on the method I used in one of my earlier tutorials. The next logical step was to write a script that automates the whole process, turning a POVRay scene into a Flash animation in a single step.
The script method I used is quite simple: It takes a POVRay scene with the variable "FACT" declared in various places, loops through 0-to-350 for the variable (changing the rotation of abjects controlled by "FACT"), generates the frames, uses Image Magick to crop the frames to 240x240 squares, saves them in sequence, builds the Flash script, and calls the swfc compiler to compile it.
Before anybody asks "Why don't you just use png2swf for that last step?" - I tried it, but the animation comes out much choppier.
Very efficient, although limited in what it can produce without some fancier POVRay programming. But I think I've lost everybody now, so I'll just post what I've produced so far.
First a simple heart animation, done just a tad late for Valentine's:
Next, one of those "I wonder what this would look like?" moments hit, and I slapped some multicolored nodes into a blob object and ran the script:
I have no idea what I made there, but I promise not to let it get loose and terrorize the world. Next, I put a little effort into designing some clockwork gears:
Ooooh! This last one is a keeper. I'll drop that into the sidebar Flash gallery after it falls off the front page.
By the way, b2evolution's software hates embedded objects with a passion and I have to hack it mercilessly to get it to display at all, so if you don't see anything, let me know on what browser/platform. Sloppy of me today, I know.
DrawDemon, down there in the sidebar to your right. As if yesterday's demo weren't pointless enough, I took the same idea and ran with it to produce the next step. This time, in addition to mousing over the black square to draw and clicking to clear it, you hit "L" (on the keyboard... keep up with me) to turn Lines on and off, "C" for Circles, and "S" for Squares.
Thanks again to SWFTools. It's going to save the world.
It makes pictures. Like
There's no way to save images directly. Your screenshot program is your friend.
Holy smoke - it's been four months since I put up a new SWFTools Flash example. This is inexcusable. From now on, readers, you'll have to nag me when I go that long.
This time it's a toy, as opposed to a game, because you just mouse over it and it makes pretty pictures and you click anywhere to clear it and draw some more. It's called Circlerama, follow the link or scroll down to the bottom of the blog sidebar where the Flash BlogSquares usually are, and look for a mysterious black square.
It makes images like this. Or this. Or even this. The source code is too small to bother with a tarball, so I'll just post it here.
...assuming you saved it as 'source.sc' of course.
Note that it's pure ActionScript through and through. And hiding within this lame little toy is the formula for two things I've never seen done in a raw-source ActionScript example on the web before - drawing a circle and automatically changing a color. Since the color has to be in hex, we adjust the variables for red, green, and blue independently, then form the color hex code inline with the bitwise formula you see as an argument to 'beginFill'.
As for the circle, we cheat by simply drawing with the built-in moveTo/drawTo commands 100 times, with our trigonometry friends 'cos' and 'sin' to bend it around the circumference. If it looks too scary, I made it compact so you can just cut 'n' paste and use its voodoo.
It's randomized, so you don't have too much control, but once it picks a new random circle and color, it shrinks it and changes the hue slightly for a few iterations each time. So you can somewhat control the outcome, yet still be surprised.
I hope it's fun for the people who don't find the code educational, and educational for the people who don't find it fun.
I might as well turn this one loose while I'm at it. New Flash game in the sidebar, name of IQ Blocks. It looks like this:
The idea is that you click go, starting the timer and changing the pattern in the upper right, and then you have to click the squares in the big place on the lower left until it matches the pattern which will stop the timer. That's it. Try to contain your excitement.
OK, this is inspired by those IQ tests you get in school where they give you red-and-white blocks and a card with a pattern on it, and you use the blocks to assemble the pattern. But I have no idea if these blocks used in IQ tests have a name, if one company makes them, or what. Any teachers out there who can fill me in?
Anyway, I thought people might find it cool to have a chance to play with these in a non-school environment, maybe for the nostalgia kick from school. It could be that nobody's ever thought of this before because it's a non-obvious concept for a game, or it could be nobody's done it before because it's a dumb idea for a game. I don't know yet, but that's why it's called "experimentation"!
I've been hedging around on this one because I wanted to beta-test in the side bar for a couple of days, but now that somebody's mentioned it: yes, I've had a new Flash game in the sidebar of this blog. Wa-a-ay down there on the right.
It's called "Drop A Block" and you play it by moving the arrow keys to move the paddle back and forth to collect and position blocks, and down arrow to drop the block into the rack below. Three-or-more of the same color in any direction makes those blocks disappear, and combos are possible. The concept is very similar to the arcade game Klax. There's no sound, saving of high scores, or even a way for the game to recognize when you're stuck. Hitting the little 'reset' button in the top left clears the board and makes the score 0 again.
Want the source code? Here yah go! GPL-licensed, includes graphics and README, and if anybody out there rebuilds this into a fuller game and posts it online, be my guest and drop the link to it in the comments. And to any ActionScript wizards out there who have ideas on how I could have done it better, I await your wisdom!
This is part of a series of little Flash toys I want to do which I'm calling "Blog Squares". The idea is to make small, simple games and toys that fit perfectly in the sidebar of a blog, on a MySpace or FaceBook page, or possibly even in a mobile device such as a cell phone, portable game console, or a Chumby. I'm working on another such project, and I have ideas for dozens more.
I like this little format, because it makes me think small and light. Also, I don't expect to make full-featured games with it, so I'm free to experiment with the concept of what makes a fun toy. Like Drop-A-Block, these would all be good for a few minute's amusement, without trying to be a blockbuster production.
Just a random batch of utterly pointless Flash animations I've been doodling out lately. Click the image below to go to the page where they're running, which may take a minute or two to load, as always. Or click here. Or even click the title. You'll probably want to control-click and open it in a new tab and then go amuse yourself for a minute until it finishes loading.
Made with the ever-amazing SWFTools FOSS Flash toolkit for Linux. In this case, there really isn't any code to show for it - I generated these using the same techniques I outlined way back here. Just draw something and then script a loop to increment some numbers to render the next frame, compile all the image frames into Flash, add cheese and serve.
Bonus Buck: We have a new pioneer in FOSS-Flash, and the site is here. In the examples, there's a very nice tutorial on making a pure SVG animation in SWFC.
Aaaaaw, you scrolled all the way down here just to see this?
Well, let's take this opportunity to say, "Thank you for
coming by my home on the web and taking the time out to share
in some of my world. Readers like you make it all worthwhile!
Be sure to check the home page and visit
some of the other features on the site."
This is Penguin Pete's extraordinarily geeky blog about
Free and Open Source Software and the wonders thereof.
The blog skin style is called "Black Ice", custom
designed by Penguin Pete all by his widdle self!
While Linux is not the exclusive focus of this site, it is worth
mentioning that Linux� is the registered trademark of
Linus Torvalds in the U.S. and other countries.