I wrote the base of the game in about an hour but the complex part take me more than i would like so I am posting the code and set the state of the development to pause.
You can play with it, change the zombies with the zombies from Zombie example and examine the Towers to add one of your own design, see the video in Youtube: http://www.youtube.com/watch?v=PjUYnDXfPA4
I would like to know a better way of using math.random() before create a genetic algorithm for the se games…
A genetic algorithm can be used for several distant topics as find a fitness value for a Mario Bross level jumping like this: http://www.youtube.com/watch?v=j3__MP1IOfA
Lol
Another thing i wanted to do is draw the health bars with the actual size related to the current zombie or tower.
This is just amazing! Really awesome looking project, juaxix. Have you thought about making it run a bit faster? It moves at quite a slow pace in your video.
I think sound() can cause an issue with random(), does it happen after you use sound()? We’ll improve the random() library to use an isolated generator in the update after 1.1.2.
I saw the same issue with my particle stuff - try not setting the randomseed. It’s bugged in some way that I haven’t been able to figure out yet - it’s AS IF it’s getting called in the draw() loop, but it’s not.
randomseed takes an integer if that helps. It slipped me up once. random gives you a number between 0 and 1 by default so saying randomseed(random()) isn’t good.
randomseed(random(Number)) dont seems to work along with this code, but nosound does…
I have accelerated the game ,fix minor bugs and now it works like a charm, oh i added a scene inspired by @voiceofreason xD
Now it has levels and different zombies hahá
Btw, the development state is still in pause mode until sound-random Bug fix appears ,maybe Simeon or another could make and share a new video with the game
@juaxix: Have you thought about normalising your speed by using DeltaTime? For example, I notice lines like this in your source code:
self.position = self.position + self.velocity
Which is a pretty standard way to move things. However that will cause your position to change based on the speed of the device. If you do the following, however:
Your position will update at a constant speed regardless of device speed. This should also improve compatibility with LoveCodify, as @SiENcE mentions.
(Note, self.velocity will need to be in different units - probably multiplied by ~60 or so to get it into pixels-per-second rather than pixels-per-frame.)
Edit: I realise the example code does not follow this practice. There’s no real excuse for that, the example code should do this too.
@Simeon do not push yourself so much, the examples are very good.
I will try Deltatime and random issues soon
I working in a new prototype as well and i will use this, thanks
@juaxix, Why dont you upload the code to Codea Community? It will save a lot of time for the users instead of individually copying and pasting from gisthub