Wednesday, January 12, 2011

Making a Flash game like Plants Vs Zombies – step 3

Making a Flash game like Plants Vs Zombies – step 3:

Here we go with 3rd step of Plants Vs Zombies game. Now we will place the bought plant on the game field and let the zombies enter.

Adding a zombie is quite easy because we manage it in the same way we managed the sun. Just like suns appear out of the top of the stage and then fall down, Zombies appear out of the right edge of the stage and move left. They don’t interact with plants yet.

As for placing the plant, we have to make sure when the player presses the mouse while dragging the plant that the tile he wants to place the plant is free and it’s inside game area. Then the plant is placed, the selector and the listener are removed, and the routine starts again with the player collecting suns and selecting which plant (only one available at the moment) to place on the game field.

I commented line by line the whole code, to help you understanting what’s happening [...]

No comments:

Post a Comment