At the beginning click one of the resources to start harvesting (blue, red, green or purple). you will always be harvesting whichever resource you clicked last. You can spend your resources on any of the upgrade buttons (color coded with the big dots). to increase your income you can upgrade harvest speed (the cost increases with each purchase, hence the "speed.cost" variable, or you can upgrade how many of each individual resource you gain every "harvest.speed" seconds by spending the same resource that you want to upgrade: just click the upgrade button under that resource.)
Sorry if it is too confusing. You die when your wall health reaches zero. Hint: you should harvest purple first and upgrade your healing tower, otherwise your wall won't heal at all. (or try your own strategy)