Feedback: The Bane of Soldiers


#1
Level summary

Goals: Detonate the robobombs; save most of the soldiers
Robobombs explode when they die or touch an enemy.
Split up your soldiers so that they don’t all get exploded together.

The concept of spreading out soldiers to avoid splash damage hasn’t been covered in detail in other levels so it is a good idea.
The level is quite easy and is passable with a simple strategy but that’s fine for an introductory level.
My strategy involved repeatedly commanding ally[0] to go right and the others to go left. Of course, many improvements can be made such as commanding the rightmost ally to go right instead of the first but my initial strategy still passed
There is potential for more complicated levels involving soldiers and robobombs (or catapult shots).

Edit: Another thing, the starting code contained some python syntax that I had never seen before:

for index, friend in enumerate(friends):
     # command soldiers

Some possibilities:

  • robobombs randomly approach from all sides
  • robobombs or catapult shots randomly fall from the sky above your soldiers
  • both of the above at the same time
  • fight robobombs mixed with other enemies
  • you control robobombs or artillery and need to hit clustered groups of enemies

#2

hmm this looks like a very interesting concept for a level like having to get soldiers id’s in a array then split those arrays


#3

Yup, good points about making more levels using more advanced robobomb scenarios. Want to make some? :slight_smile:


#4

I am having trouble figuring out how to pick out part of an index in the code. I can tell them all where to go, but not individuals…

loop:
    friends = self.findFriends()
    for index, friend in enumerate(friends, 0):
        # Use the index to decide where to command each soldier to move.
        for friend in friends:
            self.command(friend[0], "move", {'x':16,'y':16})
            self.command(friend, "move", {'x':50,'y':59})

the next to last line throws an error as I guess maybe I need to reference index or something. Any help just learning syntax to reference an index would be appreciated.


#5

I don’t even understand howto code it I know what I wan to do but the
loop:
friends = self.findFriends()
for index, friend in enumerate(friends):
# Use the index to decide where to command each soldier to move.

doesn’t make any sence with me could you explane what it does


#6

I had a hard time understanding how enumerate works based off what they give you. I watched some youtube and think I get it now. I beat this one by calling out the number or index assigned by the enumerate function in python. It is not elegant. I am sure someone can show a much better way. I will try in a moment. But I was able to just separate each friend by the index from enumerate. You could have created a list of positions and then assigned them matching the index’s from each I think would be less code.


#7

could i have some help? What did i do wrong?

loop:
friends = self.findFriends()
for index, friend in enumerate(friends, 0):
# Use the index to decide where to command each soldier to move.
for friend in friends:
self.command(friend[0], “move”, {‘x’:16,‘y’:16})
self.command(friend, “move”, {‘x’:50,‘y’:59})


#8

This type of code is confusing can you guys make a video on how to do the level but not only that but how the code works step by step so we can get a deeper understanding because I think me like many don’t have anybody to teach us this so we can fully understand it.:kissing_heart::innocent:


#9

Hello. Not quite sure if it just me, but this level is not allowing a python syntax. It is popping up only in what i believe is LUA. Advice?


#10

also lost…

I still don’t fully understand arrays or for loops

A video explanation and some practical application examples would be great!


#11

Have you worked through the Desert and early Mountain levels? Those should give you enough understanding of arrays to do this level.

Be sure to read the comments carefully, they usually provide you insight on what you need to write.

If all else fails, post your code so we can identify where the problem may be.


#12

I did but this one is really hard and it’s hard to understand without some pointing out.


#13

Please do not bring up untouched topics


#14
# Send the first soldier of the friends array towards the enemy.

how do I do this? Someone please help me! Thanks :grin:


#15

Also, I have already responded to your newly created topic and hope my advice can help you. :slight_smile:

(EDIT: Whoops…I didn’t mean to respond to _TD_RodYT…only meant to quote :sweat_smile:)