Onboarding - Puzzle discussion

i nead help

Please explain what help you need in detail.

1 Like

I would like to learn coding :grinning:
Today my first day

is their any tutorial

What topic of tutorial are you looking for?

Welcome developer

if (dist1 > dist2){   
 console.log(enemy2)
    
}else{
    console.log(enemy1)
}

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.

Does this help answer your question?
https://www.hackingwithswift.com/sixty/10/4/force-unwrapping

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. :flushed:

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.

1 Like

I don’t program. a game title :_)
Can anyone help me :((

1 Like

Help! I am so not used to this. I am still new.

1 Like

hi
I am also new but i can help

2 Likes

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

1 Like

import pygame
import random

Initialize Pygame

pygame.init()

Set the screen display dimensions

screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))

Set the title of the game window

pygame.display.set_caption(“My FPS game!”)

Define some colors

WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)

Set the clock

clock = pygame.time.Clock()

Define the player

class Player(pygame.sprite.Sprite):
def init(self):
super().init()
self.image = pygame.Surface((50, 50))
self.image.fill(WHITE)
self.rect = self.image.get_rect()
self.rect.center = (screen_width / 2, screen_height / 2)
self.speed = 5
self.health = 100

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

def update(self):
    if self.direction == "up":
        self.rect.y -= self.speed
    elif self.direction == "down":
        self.rect.y

can you change this so it works for my fps game

I don’t think you are in the right place for that.

is there any more puzzels for this game

No, not even a community puzzle.

1 Like

i really need help i just started today

1 Like

need help coding its to hard im new to this

i wolde help you but im olso new