The loadWave method checks for the next wave that should appear, creates the corresponding enemies based on the wave information, and schedules them to appear on screen accordingly.
Okay, theres only a few details left to add until you are in possession of a fully-featured tower defence game!
The player can only purchase and place as many towers as they can afford, based on their gold reserves.
Waypoints count-1 destinationWaypoint xtWaypoint; CGPoint pos Position; myPosition pos; mySprite setPosition:pos; theGame addChild:self; self scheduleUpdate; return self; -(void)doActivate active YES; -(void)update ccTime)dt if(!active)return; if(theGame circle:myPosition withRadius:1 collisionWithCircle:Position collisionCircleRadius:1) if(xtWaypoint) destinationWaypoint xtWaypoint; else /Reached the end of the road.The towers attack range is drawn as a white circle; if an enemy is within the towers range, the tower will fire on the enemy until the enemy is destroyed, or they move out of range of the tower.I've added this additional UI layer, just like I had this Game layer so that I can easily manage the.Most also apply splash damage and slow damage.But what good is all this firepower without any bad guys?So what are these lines of code doing?The reason why it follows your mouse cursor and moves along with it will be explained later in the game loop.Add it to the current position to get the new position.GameEnded is set once the game is over!
Name the class Waypoint, and make it a subclass of CCNode.
Assuming the enemies have multiple layers to break down, the enemies have to have multiple costumes.
They add a ICK listener which will trigger the clickTowerFire function when the player clicks on the button.Monsters is the array that will store the monsters that come in waves to harass you.Each waypoint knows the next waypoint in the list.The player has to defend against 20 waves of monsters.The first array contains six dictionaries.In that line, it checks if this variable is not null (meaning it currently contains something already, which would mean that you have previously clicked another tower and if so, it removes it from the mcGameUI and sets it to null.Enemies removeObject:self; /Notify the game that we killed an enemy so we can check if we can send another wave theGame enemyGotKilled; / Add the following methods -(void)getAttacked Tower attacker attackedBy addObject:attacker; -(void)gotLostSight Tower attacker attackedBy removeObject:attacker; -(void)getDamaged int)damage currentHp -damage; if(currentHp 0) self getRemoved;.Defend your castle games are normally click to defend games.Every enemy constantly checks if it's progress is greater than the "lead progress" global variable.How to visually debug how to make a lego set the waypoints and attack ranges of towers.