Dance-off how to beat?


#1

I can’t seem to beat the level dance-off. I tried my best but still can’t beat it. if someone got pender spellbane availeble to purchase plz share your code. :triumph:


#2

Maybe just a typo in your code. Can you post it here, and we’ll see what we can do.


#3

How to move in sync with my dance partner?


#4

Well, how do you figure out where your partner is?? (see cragtag if you don’t remember (read the provided comments))


#5

ohhh I understand it’s yeah but if you submit it’s turns different


#6

That is why you do not write specif code what you want to do it write strings like this

this.moveXY(this.pos.x + 10,this.pos.y);

#7

thanks I think I understand

this is my so far code:

loop:    
    friends = self.findEnemies()
    friendIndex = 0
    for friend in friends:
        if self.distanceTo(friend) < 10:
            self.move(friend)

I’m currently editing it.

somehow my character will never move confused

merged your following posts

Please Read the FAQ, it will tell you how to format so your code looks to us like it looks to you.
and if you are the last to post, please edit your previous message to add more.


#11

I’m also lost in this one.


#12

Ok, watch this video, it was the best that I could find quickly to show you the idea.

4-wall Line Dance

Notice how they are always the same distance apart… (if Dance Off were like that you could pick anyone as your “partner”)

But in Dance Off your partner, the one you “follow”, is the one closest to you in the other line…

rehint

If Feinty hinted any stronger he’d have to write the code for you . . . and that isn’t going to happen here.

iow

copy it, translate it (if necessary) into the programming language you are using, run it, see what it does right & wrong then fix & rerun it, until it works.


#13

I know how to dance… Oh my god…


#14

Well, there you are then.


#15

This does not make any sense. The people who are new to coding wont have any idea what to do (LIKE ME). They don’t teach you any of the concepts needed to win this level. Also, this is my code

# Move in sync with your dance partner to impress Pender Spellbane.
loop:
    friend = self.findNearest(self.findFriends())
    self.move(friend.pos)


#16

You are taught all concepts you need.

  1. Loop
  2. Find Friends
  3. Find Closest entity
  4. Read the properties of entities
  5. Read the properties of properties of entities
  6. Generate a new location (for example based on properties of properties of entities)
  7. Move to a specific location

I won’t give you more hints, as otherwise I could directly give you the code. In fact, if you look very close I kind of already did.


#17

New Code

# Move in sync with your dance partner to impress Pender Spellbane.
loop:
    friends = self.findFriends()
    friend = self.findNearest(self.findFriends())
    friendpos = friend.pos
    fx = friendpos.x
    fy = friendpos.y
    if self.now() < 6:
        self.move({'x': fx, 'y': 42})
    if self.now() < 14 and self.now() > 6:
        self.move({'x': fx, 'y': fy + 6})
    if self.now() > 14 and self.now() < 17:
        self.move({'x': fx, 'y': fy + 6})

at about self.now = 15.3 Omarn Thinks that Hushbaum Is his closest friend isntead of Senick (in this instance) and messes it up. What should I do?


#18

Maybe not continuously search for friends, instead only once at the start?


#19

Yes it works Thanks! also if i unlock a hero but dont purchase it, is it possible to buy it even after my subscription expires?


#20

Yes, it will still be unlocked and ready for purchase.


#21
friends = self.findFriends()
friend = self.findNearest(self.findFriends())
loop:
    
    friendpos = friend.pos
    fx = friendpos.x
    fy = friendpos.y
    if self.now() < 6:
        self.move({'x': fx, 'y': 42})
    if self.now() < 14 and self.now() > 6:
        self.move({'x': fx, 'y': fy + 6})
    if self.now() > 14 and self.now() < 17:
        self.move({'x': fx, 'y': fy + 6})

this is my code but my hero wont stay in tune with my partner can you tell me whats wrong @nick


#22

can someone please help me


#23

@J_F_B_M how do you read the property of entities