Help! I can't seem to get a point system to work.

zion agoo
Posts
1
Karma
1
zion agoo posted this 25 October 2017

Hello everyone,

I am having trouble creating a system to act like credits for my game. I don't know some bypasses. Can someone please lead me in the right direction, please?

 

Kind regards,

Zion Agoo.

 

P.S. It's a Tower Defence game.

P.P.S Thank you whoever helps me.

Post Edited 25 October 2017

0
Stephen Coy
Posts
170
Karma
216
Admin
Stephen Coy posted this 25 October 2017

Here's a simple example.  Let's assume we want this as simple as possible so we're just going to use a single kind of tower.  We'll use the Red Score for our credits.

 

Create a tower and program it to shoot at the enemy.  We'll assume they are Kodu and that we only want to be able to shoot once per second.  This is a pretty weak tower.:

WHEN Timer 1Second DO

    WHEN See Kodu Closeby DO Shoot Blip

 

Now go into the Settings for this tower and mark it as Creatable.  This allows you to program other characters to create them along with their programming.

 

Now add a rock to the scene.  This will be where the player's programming runs.  Let's start by assuming that you get 1 credit every 2 seconds and it costs 5 credits to build a tower.

 

(1)  WHEN Timer 2Seconds DO Score+ Red 1Point                  <-- this adds one credit every 2 seconds

(2)  WHEN Scored Red >= 5Points DO                                      <-- this only lets you add a tower if you have at least 5 credits

(3)          WHEN Mouse Left DO Create Tower1 Once               <-- this will create a tower wherever you click with the mouse

(4)                WHEN DO Subract 5Points Red                             <-- since we've created a tower, subtract off the 5 credits

 

Notice on line 3 that we use the Once tile.  This way we only get a single Tower per mouse click.

 

Now you just need to add some Kodus to shoot at!

 

 

For a more complex example you can also look at the game "Fortress Defense" which comes pre-loaded in Kodu.

 

Hope this helps.

 

    Stephen

 

 

0