Flash file to make your own key icons

A couple of days ago I released two Photoshop files to make your own key icons.

Now Samuel Bonfante sent me the Flash version of those PSD files, for all you Flash maniacs.

« Hello Emanuele,
I recently saw your post “Photoshop Files To Make Your Own Key Icons”. I wondered how developers who don’t know how to use Photoshop or simply don’t have it would use your files. :) So I made this Key Icon in flash (which is pretty easy to change the colors, or add different letters/characters). I’d appreciate if you would make a post for it, but if not, no problem.

I hope they prove useful. :) »

It’s very useful… this is the Flash icon…

and this is the source code.

How to ask for help: the Philippines example

Normally everyday I receive about 10 emails asking for help.

They all seem to be made with a template, something like this: “hey this script does not work. Can you fix it?”

Obviously I cannot fix someone else’s scripts, but sometimes I got really impressed by an help request.

It happened about one year ago and it’s happening today.

This is an email from Jv Caalim from Philippines, in trouble with his computer science thesis…

« Hello Sir, and Good day.

Im Jv Caalim from the Philippines and im a computer science student from AMA computer college (a really crappy school if you ask me..), recently ive been basing my entire Thesis heavily on your tile-based tutorials (which is really really great btw im a fanboy of your site now lol).

My thesis entitled “Asian Museum” is an eduactional game aim for highschool students about, some limited scopes on a few Asian countries, it will be like a clone of castlevania (the player defeats an enemy using a linear weapon not by jumping on them) and along the way the player will recieve hints on how to open the door leading to the next level like ex:”Player battles a monster and gets
Chrysanthemun which is also a name for the national flower of Japan”, the door will be asking questions about asian countries like, “what is the national flower of Japan?”. the boss battle is a turn base system (which is only shown graphically) where random questions about asian history appears on the screen if the player answer it correctly the boss monster gets damaged

As of now i can only say that im still learning on what engine to use, ive also been reading about tonypa’s tile-based tutorials and it was quite helpfull but still there is one thing thats always leaving me confuse, the Collision engine that was used on tile based platforms engine, and if ever i tried experimenting with the collision engines it always ends messing up the collisions… sure the collision works if the “player” is smaller than the tiles but,

What if the player is bigger than the tiles?? lets say i have a 50×50 tile and the player is 49 pixels in width and 98 pixels in height (so that right = 24, left = -24, top = -49, bottom = 49) so its like the player is 2 tiles high and 1 tile wide, or what if the tile size is 25×25 meaning the player is 4 tiles high and 2 tiles wide? how can i make a collision engine for that?

i already know how all the basic movements of the character works and already applied that to a non tile based platform engine that i made (which has a lot of frustrating collision bugs). im not at all a beginner on programming nor a pro but, i have background on programing on VB and C++ on simple programs, and the basics on programming on AS2 (but im still confuse on AS3).

so i would like to ask for some help or at least a detailed explenantion on how i can fix my collision problems. i know that you are a very busy person and im sorry if i have to ask too much of a favor, im still a student i dont have a job yet so im sorry if i cant pay you anything but, i could at least give you all the rights on the game(thesis), most specially the “player sprite” i made by hand (its still not finish but i will give you all of it if its finished), you can also ask me to make you some sprites on your game for free if you like, so pls im begging for help… the submission for the thesis will be on Dec 6, and i havent really made anything that could be usefull to the game except the sprites.

P.S sorry if my sentences sounds as if i was demanding (or commanding you), my english is a bit bad.

Hoping for your relpy and more power to your site
(some of my recent experiments on .fla is attach on this email pls do scan it first for precausions) »

You will find the files here.

I hope Jv (I am really curious to know does it sound this name) can get some help, maybe someone can save his thesis.

Platform game basics using Box2D

I wrote about Box2D Flash version about a year ago, then I published Playing with Box2DFlashAS3 and Create a Flash game like Totem Destroyer as examples covering what you can do with this library.

But I was really impressed by a thread on TriquiTips submitted by Hawdon called Box2DAs3 For Beginners! (read steps 1 and 2) that in my opinion deserves to be posted on this blog, to reach a wider public… because I know there is a lot of people looking for AS3 and Box2D and platform tutorials… and the prototype made by Hawdon merges them all this way:

Left-right to move and up to jump

This is the source code with some comments Read more

Developing hex map concept

Some months ago I released some tutorials about hexagonal tiles (and I developed an Halloween game based upon Hex maps creation and rollover and Finding adjacent cells in an hex map 1 and 2).

Later, Douglas Huskins told me 10 years ago he wrote a collection of functions that would help a person navigate hex maps. The functions included: Identifying the adjacent hexes, identifying the shortest path between two hexes, the relative position of a hex from the perspective of another hex and the distance between two hexes.

This can be really useful to make some strategy games.

Unfortunately most of the work seems to be lost, but Douglas still wants to share the concept with us, so he is rewriting it in Javascript.

Read what he says:

« I could not find my electronic copy of the source files.

All I have are some old Visual Basic printouts that lacked much documentation. I have recoded it into Javascript and need to test it.

However, here are two of the functions: Move and Range.

The hex map layout this code works for is based on a hex map with the points laying horizontally. The top and bottom of a hex are flat.

Hexes are numbered such that the first set of digits represent the column number and the second half of the hex number’s digits represent the row number.

A typical hex number would be 0132. That would be a hex in the leftmost column and would be the 32nd hex down from the top.

This type of map comes in two flavors. The way to identify the two types of layouts is to compare 0101 with 0201. If 0101 is above 0201, then it is referred to as “Odd Column Up”.

The code is able to support either flavor. There is a variable set at the top of the file (mapOddUp) which will let the code switch between the two layouts.

The unit (ship/car/etc) that sits in a hex will face one of the hex sides. The faces are numbered clockwise using either 0-5 or 1-6. Again, the code supports both numbering systems by treating 0 and 6 as the same direction (straight up). There is a variable at the top of the file (mapIsUp0) that determines which facing number system to use.

The code has the ability to change the map size. There are max and min values that can be set.

If you have any questions, please let me know. I will convert the remaining functions next week. After that, I will properly test everything and add a simple interface for it. In the meantime, this should help you create hex based games. »

Here it is the source code: Read more

New tile based platform engine - AS3 version updated to step 10 PLUS scrolling

If you are looking for AS3 version of step 10, here it is… made by Robin vd Vleuten from the Netherlands with scrolling included!

Hello Emanuele,

I made it with flex so I use a swc to access the tiles. All the code is now in one actionscript-file, but I’m trying to convert the code in different classes. I will email it also when its finished if you’re interested in it.

Also many thanks for helping me out with the basics of a platform engine. It helped me a lot with a project I’m working on.

Regards,

Robin

P.S. Just another cool thing I had forgot to tell you. I made the game scrollable with just 2 extra lines of code :D

Here it is the source code… Read more

Put a banner with your MochiAds stats in your blog

Let’s imagine you made an awesome game and monetize it with MochiAds, and want to show your readers/the world how much your game rocks, now you have an interesting option.

Thanks to Rhu from Blargh now you can have a banner showing your game stats.

I am talking about something like this

You can find an easy wizard at the official page and some more suggestions in this MochiAds forum thread.

I asked Rhu to give me more information about this project and this is what he said:

« Gathering data can be done through JSON, the link for which can be found here for example:

https://www.mochiads.com/share/stats/plant-life/2b23e0751a87928d/json/impressions?start_date=2008-10-01&end_date=2008-10-06

It works equally as well if you just type in (last time I checked, they just changed to the above format recently I noticed):

https://www.mochiads.com/share/stats//json/impressions?start_date=2008-10-01&end_date=2008-10-06

The start/end dates will obviously need to be changed.

Graphics are all done through PHP, and are updated in the morning (the JSON stats suffer from the limitation of being updated once daily :) ). I also just got told that they’re probably going to make it into an officially supported API sometime soon, so everyone should be able to make their own stats programs without much hassle (and without worry of them changing the JSON format :p ) »

That’s really nice, I should consider developing a WP widget showing game stats…

Basic level editor for a tile based game

I am sharing with you a basic level editor made for the platform engine but easily adaptable to any tile based game made by Daniel Felipe Rodriguez

Your recent set of tutorials about the platform engine inspired me so I decide to contribute to your cause, I made a really really basic level editor but I’m sure it will help the level design, and maybe some future projects because the editor can be adapted really easy to any game.

In a future I will do a better editor, but this was just a quickly one, because really love this tutorials, continue with the good work!

The editor is made in AS3 Read more

Create nice background effects with Flash Random Movement

This is a Flash effect you can use for a background effect or for a shoot'em up wave (hint! hint!)

I received this script from Ashker (the creator of Olympclicks)

« Hello Emanuele. Today I tried to make an object move in a circular motion in Flash, and i succeeded. I also discovered that i could make other random motions by changing a few variables.

Thought of some ideas it could be used for : background animations, creating new level designs, creatin paths for Enemies. »

That's right!

With this simple script:

ACTIONSCRIPT:
  1. attachMovie("ball", "ball", 1)
  2. ball._x = 250
  3. ball._y = 200
  4. timey = 0
  5. fps = 3
  6. xvel = 0
  7. yvel = 3
  8. xcha = .1
  9. ycha = .1
  10. i = 0
  11.  
  12. onEnterFrame = function(){
  13.     timey ++
  14.     if(timey == fps){
  15.         dave = _root.attachMovie("blob","blob" + i, _root.getNextHighestDepth())
  16.         dave._x = ball._x
  17.         dave._y = ball._y
  18.         timey = 0
  19.         i++
  20.     }
  21. }
  22.  
  23. ball.onEnterFrame = function(){
  24.     this._x -= xvel
  25.     this._y -= yvel
  26.     xvel += xcha
  27.     yvel -= ycha
  28.     if(xvel>= 3 || xvel <= -3){
  29.         xcha = -xcha
  30.     }
  31.     if(yvel>= 3 || yvel <= -3){
  32.         ycha = -ycha
  33.     }
  34.     if(this._x> 500){
  35.         this._x = 0
  36.     }
  37.     if(this._x <0){
  38.         this._x = 500
  39.     }
  40.     if(this._y> 400){
  41.         this._y = 0
  42.     }
  43.     if(this._y <0){
  44.         this._y = 400
  45.     }
  46. }

playing with xvel, yvel, xcha and ycha you can achieve a wide range of effects.

Ashker invites you all to play with these variables and eventually publish here the most interesting results.

Here are some random effect you can make:

Download the source code and share interesting values, and I'll show you how to use them in a shoot'em up.

Useful information about WP powered arcade sites

Yesterday I started my project called Creation of a Flash arcade site using Wordpress and today I received a lot of emails from readers that want to run their own WP arcade.

I want to share with you some really useful information sent me by a reader who prefers to remain anonymous.

This post will help you if you want to start building your own WP arcade.

Here we go:

The reasons I chose Wordpress are:
- Its free :)
- I am primarily just going to be hosting my own games, so I don't need anything too fancy and Wordpress is as simple or complex as you need it to be.
- Most arcade scripts have a lot of features I simply wouldn't use and can cause clutter / extra pressure on server.
- Most software specifically geared for Content Managment (CMS) are more complex than I need. Wordpress is fairly easy to use.
- There is a vast user base and long established community with support for most things you would need.
- Highly customisable and with a lot of community support for template editing.
- SEO friendly and search engines supposedly 'like' Wordpress.
- Support for caching and other memory saving stuff.

With regard to caching I was looking into this yesterday and thought you might find this useful. As you know the main eventual aim of any games site is to pull in decent traffic. The downside to this is that any high traffic site is going to eat up CPU and RAM leading to the server being killed and loss of profits due to downtime.

To help prevent this I read that using multiple layers of caching amongst other things dramatically helps. Caching basically means the user is redirected to a static page rather than sending a request to pull the content from the database which can heat things up. The only drawback is that your content becomes less dynamic. So if you want to get into dynamic instant user interaction etc. it may or may not really work out. I'm not sure. If you plan to keep things fairly simple however it will definitely be a massive help.

In summary its like this ranging from least complex to more complex (I'll include everything even if some may be a bit obvious):

- Try to avoid overcrowded servers. Mainly ones that advertise "unlimited bandwidth / unlimited web space". The more crowded the server the more vunerable it is to crash from high traffic. If you can afford it a decent VPS is ideal, then later moving up to a Dedicated when necessary. You can visit http://www.webhostingtalk.com where there is a lot of info on hosts and servers.

- Don't use too many plugins. Each plugin has to be loaded up. Only use what is necessary.

- Make sure to compress images and other media.

- If you're utilising RSS feeds in any way then Feedburner is supposed to be able to do some caching.

- Edit your template theme to replace unecessary PHP calls with static content. For example the title of the site will rarely change. And some things could easily be replaced with hardcoded direct text links rather than pulling the links info in. The location of your stylesheet for example amongst other things.

- For Wordpress use a caching plugin to help lessen the frontend load. Some Wordpress plugins include: WP Super Cache, Hyper Cache, 1 Blog Cacher and an upcoming Viper Cache.

- For the server using a PHP accelerator like eAccelerator or xCache is really effective. This most likely won't be possible on shared hosting. If your host can support it, then there is also a Wordpress plugin geared towards communicating with eAccelerator and xCache on the server:
http://neosmart.net/blog/2007/xcache-and-eaccelerator-wp-plugins-updated/

- Litespeed on the server also apparently helps. I do not know much about it. This may be something that many hosts already have on their servers. If not I believe it is not free and may need further looking into. Again probably not something you can request on a shared host.

With all of this it can help the load on the server by quite a large amount and can help to carry to strain of a burst of traffic.

Some extra items that may or may not help:
- Remove unecessary items from the dashboard:
http://wordpress.org/extend/plugins/wordpress-dashboard-editor/

- "The default WordPress install has the option turned off to pre-load all the option settings at once. If you turn it on, you'll probably drop the queries by a half-dozen or more. Try putting this into your wp-config.php and see what happens:
$wp->load_options = true;" by ck

- htaccess caching (may or may not be necessary after above)

- If you get so much high traffic that you start using multiple servers then WP-Offload plugin apparently redirects to caches on external servers.

- tcp read and write socket memory buffers (really not sure what this is about, maybe something to look into if you're still suffering after doing all the above)

- MySQL query cache (again something to try after all the above. I read it may slow down things slightly so it may depend on your needs as to if this is beneficial, I would read into it further before trying.

- You can really go the full hog and optomise every aspect of the server and whatever it is using (e.g. Apache etc.). I would reccomend seeking advice before doing so incase of damaging anything and probably as a last resort if the above doesn't help.

Again a lot of this stuff is mainly for VPS etc. rather than Shared.

I got a lot of this information and the quotes from the comments on:
http://www.codinghorror.com/blog/archives/001105.html

The only thing I'd be worried about is that there are some Digg users who like to 'test' Wordpress blogs by hammering them since they feel Wordpress is easy to bring down.
http://digg.com/programming/Let_s_Bring_Down_.....
Although those seem to usually be isolated vandalism incidents I think (mainly if anyone utters the word "I can now survive high traffic and/or Digg effect" they are signing their death wish. Search for "wordpress digg effect" on Digg).

Create a Flash game like Deflection - part 2

Multipart tutorial: available parts 1, 2, 3

In the 1st part I showed you how to make a deflection engine starting from an old tutorial, now it's time to let the player draw walls.

The idea comes from Srdjan Susnic, a reader who runs the blog Ask For Game Task.

The main task Srdjan accomplished was to add a mouse control so a player can draw lines from which the ball will bounce.

After collision between the ball and a line drawn by mouse, that line must be removed

The code is clear and well commented, but it seems to suffer a bug if the player just clicks the mouse without drawing.

It's just a minor issue I fixed in a moment, and if you already read the original post, I just added the control if the player drew a line when he releases the mouse button with player_drew variable.

Anyway, this is the actionscript: Read more

Next Page →