lvl I Copy paste the solution and its still the same result as with my own code…
also I get the Error Message
“Warning: your code did not read all available input before printing an instruction, your outputs will not be synchronized with the game’s turns and unexpected behaviour may occur.”
as far as I understant the whole first block of read enemys and distanc is fully corect and I don`t need to correct it?!
Howdy, I am new here. But not new to programming. Although, new to Swift. First off, thank you for providing such a great platform! Your rock!!
Second, in this puzzle, I understand readLine()! but I am not sure why there is a second ()! appended at the end–is it because of Int-ification? I scoured the docs but to no avail.
Appreciate a reply from a kind-hearted fellow journeyman.
I have a confession to make - in a hunt for more achievements (CG drove me into that frenzy with the ‘Win 100 achievements’ milestone on the Quest Map), I discovered that each time I open the Onboarding Puzzle, it moves me through the tutorial, let’s me select any language, and gives me the exact code for that language to use. This gives me the ‘… Explorer’ achievement for every language I select and complete it with.
Might it be an idea to let the tutorial only happen once for a user - until it is solved one time by the user in any language? Or am I the only user childish enough to gain achievements here? And, CG admins, feel free to take away all my achievements gained through the Onboarding puzzle.
Im first starting on how to code. and i don’t even know a thing about coding. is there any classes that can help me into coding? computer language is hard 0-0
def update(self):
# Update the player's position based on key input
keys = pygame.key.get_pressed()
if keys[pygame.K_w]:
self.rect.y -= self.speed
elif keys[pygame.K_s]:
self.rect.y += self.speed
if keys[pygame.K_a]:
self.rect.x -= self.speed
elif keys[pygame.K_d]:
self.rect.x += self.speed
# Keep the player on the screen
if self.rect.left < 0:
self.rect.left = 0
elif self.rect.right > screen_width:
self.rect.right = screen_width
if self.rect.top < 0:
self.rect.top = 0
elif self.rect.bottom > screen_height:
self.rect.bottom = screen_height
# Check for collisions with enemies
for enemy in enemy_sprites:
if pygame.sprite.collide_rect(self, enemy):
self.health -= 10
enemy.kill()
# Check for collisions with enemy bullets
for bullet in enemy_bullet_sprites:
if pygame.sprite.collide_rect(self, bullet):
self.health -= 5
bullet.kill()
class Bullet(pygame.sprite.Sprite):
def init(self, x, y, direction):
super().init()
self.image = pygame.Surface((5, 5))
self.image.fill(WHITE)
self.rect = self.image.get_rect()
self.rect.center = (x, y)
self.speed = 10
self.direction = direction