Solution about drop the flag on python pls


#1

i pass lot of hour on this level and i don’t found help me pleas


#2

Hello fabian21

Normally a solution is not given without some effort from you, and usually it is a solution derived from your work.
To get the best help this community can offer, we need some more informations from you.

  1. What is your actual problem?
    You spend hours on this level, but what did you do in these hours? Give us your existing code, and tell us where you think is going wrong.
  2. If you get an error-message, write its content here or post a screenshot.
  3. If you think something in the game is broken, post the log of you JS-Console. There should be a red errormessage in there if something really broke.
  4. Be friendly. We like to help you. But sometimes you have to give us time. Maybe everyones sleeping. An answer can need up to a day, so try some other level (maybe a multiplayer-level) in the meantime.
  5. Spellcheck. It makes your post much easier to read if you pay attention to your grammar and spelling.

Some (more) tips:
Writing

```
#some code
```

will become

#some code

Just don’t add spaces before or after the three backticks.


#3

thx my problem is i don’t find the command to assign x and y position to the flag position
for put fire trap on this position


#4

objects like flags, items, enemies all have a “pos” which contains the “x” and “y” positions.

flag = #insert appropriate flag getting routine here

then use

flag.pos.x
flag.pos.y

however you wish. This level suggest you assign them to fx and fy.


#6

that’s crap you say item have x and y pos i try:
item.findnearestitem()
and after:

if item:
     ix=item.pos.x
     iy=item.pos.y
     movexy( ix, xy)

i forget the capital but have an error tmp47 is undefined
help!


#7

You’ll need to set the ‘thing’ you found with findNearestItem into a variable, and use that, so something like:

nearestItem = self.findNearestItem()
if nearestItem :
    ix=nearestItem.pos.x
    iy=nearestItem.pos.y
    self.movexy(ix, xy)
    

hopefully that gives the idea?