# Game of Coins Step 1 - Help please [Solved]

I’ve been trying to complete Game of Coins Step 1 in Game Development 2 and I think I’ve got the code right but my hero isn’t moving.

I’ve added all of the maze objects (forest squares, coins, mushrooms) and they display ok when I run the code. The problem is that when I try to move my hero (WASD or mouse) he doesn’t actually move, he just turns to face the appropriate way for the key that’s being pressed but stays in the same location at the bottom-left of the maze.

``````# Let's start building a new Pac-Man style arcade game.
# We will continue working on this game in the next levels.

# First we need the forest.
# Let's spawn some "forest" tiles in a grid pattern.
game.spawnXY("forest", 16, 16)
game.spawnXY("forest", 32, 16)
game.spawnXY("forest", 48, 16)
game.spawnXY("forest", 64, 16)
game.spawnXY("forest", 16, 32)
game.spawnXY("forest", 32, 32)
game.spawnXY("forest", 48, 32)
game.spawnXY("forest", 64, 32)
game.spawnXY("forest", 16, 48)
# As you can see the distance between them is 16 meters.
# Spawn more forest tiles in the three spots
# where they are missing
game.spawnXY("forest", 48, 48)
game.spawnXY("forest", 64, 48)
game.spawnXY("forest", 32, 48)

# Next we spawn coins in between the forests.
# Leave free space for mushroom power-ups!
# Scroll down, there are many coins.
game.spawnXY("bronze-coin", 16, 8)
game.spawnXY("bronze-coin", 24, 8)
game.spawnXY("bronze-coin", 32, 8)
game.spawnXY("bronze-coin", 48, 8)
game.spawnXY("bronze-coin", 56, 8)
game.spawnXY("bronze-coin", 64, 8)
game.spawnXY("bronze-coin", 72, 8)

game.spawnXY("bronze-coin", 8, 16)
game.spawnXY("bronze-coin", 24, 16)
game.spawnXY("bronze-coin", 40, 16)
game.spawnXY("bronze-coin", 56, 16)
game.spawnXY("bronze-coin", 72, 16)

game.spawnXY("bronze-coin", 8, 24)
game.spawnXY("bronze-coin", 16, 24)
game.spawnXY("bronze-coin", 24, 24)
game.spawnXY("bronze-coin", 32, 24)
game.spawnXY("bronze-coin", 40, 24)
game.spawnXY("bronze-coin", 48, 24)
game.spawnXY("bronze-coin", 56, 24)
game.spawnXY("bronze-coin", 64, 24)
game.spawnXY("bronze-coin", 72, 24)

game.spawnXY("bronze-coin", 24, 32)
game.spawnXY("bronze-coin", 56, 32)

game.spawnXY("bronze-coin", 8, 40)
game.spawnXY("bronze-coin", 16, 40)
game.spawnXY("bronze-coin", 24, 40)
game.spawnXY("bronze-coin", 32, 40)
game.spawnXY("bronze-coin", 40, 40)
game.spawnXY("bronze-coin", 48, 40)
game.spawnXY("bronze-coin", 56, 40)
game.spawnXY("bronze-coin", 64, 40)
game.spawnXY("bronze-coin", 72, 40)

game.spawnXY("bronze-coin", 8, 48)
game.spawnXY("bronze-coin", 24, 48)
game.spawnXY("bronze-coin", 40, 48)
game.spawnXY("bronze-coin", 56, 48)
game.spawnXY("bronze-coin", 72, 48)

game.spawnXY("bronze-coin", 8, 56)
game.spawnXY("bronze-coin", 16, 56)
game.spawnXY("bronze-coin", 24, 56)
game.spawnXY("bronze-coin", 32, 56)

# Spawn more coins in the empty spaces. (8 meters apart)
game.spawnXY("bronze-coin", 40, 32)
game.spawnXY("bronze-coin", 40, 56)
game.spawnXY("bronze-coin", 48, 56)
game.spawnXY("bronze-coin", 56, 56)
game.spawnXY("bronze-coin", 64, 56)
game.spawnXY("bronze-coin", 72, 56)
game.spawnXY("bronze-coin", 72, 48)
game.spawnXY("bronze-coin", 72, 32)
# Mushrooms will be our powerups.
game.spawnXY("mushroom", 40, 8)
game.spawnXY("mushroom", 8, 32)
# Spawn more mushrooms.
game.spawnXY("mushroom", 36, 25)
game.spawnXY("mushroom", 17, 37)

# The player and goal setup.
player = game.spawnPlayerXY('knight', 8, 8)
player.maxSpeed = 30
# Now test what you’ve done to make sure it works!

``````

Any help would be appreciated.
Thanks!

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Can you post your code and format it with the < /> button?

I always clicked the screen to move the hero. I think that might be what you’re supposed to do.

Thanks, I’ve added the code to my post now

Clicking doesn’t work for me either

Oh, sorry, you said that didn’t you. My bad.
Umm, I’m not really sure I’m afraid. If it’s any help, your code does work for me, so that’s not the problem. Could you post a screenshot of the level?
Thanks
Danny

Sorry, I’ve tried the level several times and it’s just started working again. I still don’t know what the problem was.

1 Like

No, it’s fine. I’m glad it’s sorted out. It did seem like a bit of a weird error .
Danny

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.