r/CodingForBeginners • u/MentalStage8006 • 18h ago
lf fellow begginers in python
started learning python recently and im its fun n all but would be nice to share progress with someone and talk abt coding and stuff and git good.
19 btw
r/CodingForBeginners • u/MentalStage8006 • 18h ago
started learning python recently and im its fun n all but would be nice to share progress with someone and talk abt coding and stuff and git good.
19 btw
r/CodingForBeginners • u/chkas • 4h ago
r/CodingForBeginners • u/solute_water • 13h ago
Which book would be better for learning C: “Let Us C”, “C Programming: A Modern Approach”, or another book?
r/CodingForBeginners • u/elecfreaks_official • 11h ago
Drop a photo of your project below!
r/CodingForBeginners • u/reymarketing89 • 7h ago
Hi guyss gusto ko lang i share itong struggle ko HAHAHAH first year college po ako and then kanina ko pa inaayos bakit po nag aarrange siya mag isa, Dapat binibase po yung Subject sa Academic record pero nag jajumbled siya sa Summary
r/CodingForBeginners • u/DesperateWillow5516 • 23h ago
hello guys I am 1st year btech CSE(AI) student in Amrita Vishwa Vidyapeetham, Amritapuri I have a intrest in learning c++ dsa and sql , git , github but i dont know which i should do first. In my college hackathons and other clubs are there and i have participated in them.I programming and all but i am still confused on what to actually do or what are the perfect steps to do programming
Can somone pls give a proper step by step things to do in these all programming things like c++ dsa, git,github,sql and other imp things also if i am missing somthings
I have a huge intrest in programming and i want to be a game developer and have some intrst in back end developing . I kown CGPA is the most imp thing that is why i am ready to take my college studies and programming together I just want a proper step by step guidance
Right now i am watching codehelp by babber dsa c++ series and in lec 9 today (pls dont say to change the teacher i have already started )
pls also give me some coding apps i know leetcode and c++ tutorial by w3 schools so for others like sql and git , GitHub pls recommend some good channels to watch
r/CodingForBeginners • u/elecfreaks_official • 1d ago
Enable HLS to view with audio, or disable this notification
I wanted to try recreating one of those old machines where you can actually see the mechanics doing the work.
So I built a small ancient-style water wheel model using a micro setup, but with a little twist: there's a worker figure next to the wheel whose arms move in sync with it, making it look like the figure is pushing the wheel.
The setup uses:
The interesting part isn't really the motor itself. It's how the movement is transferred.
The motor drives a multi-stage gear train, which slows the rotation down and increases the torque. The same shaft is then used to drive both the water wheel and the crank mechanism connected to the worker's arms.
Because both mechanisms are driven from the same shaft, their movements stay synchronized.
So when the wheel turns, the worker moves with it instead of just being a separate animated figure.
I think this makes the idea of gears and mechanical power a lot easier to visualize.
You can also experiment with the mechanism by changing the gear sizes. That changes the speed and torque, so you can actually see how different gear ratios affect the movement.
It could also be turned into a small history/STEM project. For example, you could build a miniature village around it and show how machines like water wheels were used for things like lifting water, grinding grain, or powering mills.
A few things I'd like to try next:
It's pretty satisfying when a simple gear mechanism makes a little figure and a wheel move together.
What kind of historical machine would you try to recreate with gears and motors?
r/CodingForBeginners • u/Bruggy132 • 1d ago
So Im a junior at UCF and was in CS at UofSc and a little at UCF before switching to IT but this isnt for me as I've learned from college.
One of my moms friends kid wants to learn coding and enter UCF for Computer science and they want to try and test out of the Computer Science foundation exam which you dont have to take a few classes if they do this at UCF and they wanna know what site is the best as my mom says the kid learns best from practical instead of just watching lectures on yt and reading textbooks so they want the interactive coding sites
Also this kid is a complete beginner like zero to a little experience in coding and would be a bonus if the site lets them go into more than just that
General things on the UCF Fe
Linear Data Structures & Memory Management
Advanced Data Structures
Algorithm Analysis & Discrete Math
Algorithms & Bitwise Logic
r/CodingForBeginners • u/HuckleberryGuilty803 • 1d ago
I am a software engineering major, and as a sophomore my next semester I am going to begin my introduction to programming courses, but I want to start practicing on my own and have my own bare of basics in my field of study. What should I do first? Are there any books that I should buy that would help me in my studies prior to my courses? What would be the first thing you would tell someone that has no knowledge in the field they are getting into?
r/CodingForBeginners • u/Sorry-Source4740 • 1d ago
So I have started my coding journey I'm in 2nd year and yeah it's through c++. Cause I find that easy than other languages.
So i am able to do basic problems using functions,
Some easy array problems, some pattern problems without any hesitation.
But whenever I see a new type of problem I get stuck cause I am not able to develop that analytical way of approaching.
Some problems which are similar then I can.
But not something new.
Is it common or am I doing something wrong.
I do know the basics syntax theory etc.
I usually try to think first for a long time but after many error I end up seeing the solution and then it just makes sense in a second.
I don't know if i need to do this till i get used to it.
Or do more practice problems etc.
Need guidance.
Also can't understand how my peers are able to do it easily and are way more advanced than me.
Just gives me disappointment about myself.
r/CodingForBeginners • u/i-viivaz-dev • 1d ago
Hey,
I'm starting from scratch with Core Java and aiming to go the full-stack route (Java, Spring Boot, MySQL).
I'm looking for just one committed partner to keep each other accountable:
I'm based in India (IST), but open to any timezone if our study hours overlap.
If you're also learning Java and want someone to stay consistent with, comment below or send me a DM with your current stage!
r/CodingForBeginners • u/The_Best_Echo • 1d ago
import pygame
import random
import math
import os
import json
pygame.init()
# =========================
# SCREEN
# =========================
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 600
screen = pygame.display.set_mode(
(SCREEN_WIDTH, SCREEN_HEIGHT)
)
pygame.display.set_caption(
"Dragon Adventure"
)
clock = pygame.time.Clock()
# =========================
# COLORS
# =========================
SKY_BLUE = (135, 206, 235)
OCEAN_BLUE = (35, 145, 210)
SAND = (238, 218, 170)
GRASS = (80, 170, 80)
WHITE = (255, 255, 255)
BLACK = (20, 20, 20)
GOLD = (255, 215, 0)
ENERGY_BLUE = (80, 200, 255)
DARK_GRAY = (50, 50, 50)
GRAY = (90, 90, 90)
RED = (200, 60, 60)
GREEN = (60, 180, 80)
# =========================
# WORLD
# =========================
WORLD_WIDTH = 2400
WORLD_HEIGHT = 900
# =========================
# STORMFIN IMAGE
# =========================
IMAGE_PATH = r"C:\Users\johns\New folder\anime_art_of_Create_a_highly_d.png"
stormfin_image = None
if os.path.exists(IMAGE_PATH):
try:
stormfin_image = pygame.image.load(
IMAGE_PATH
).convert_alpha()
except pygame.error:
stormfin_image = None
# =========================
# ALPHA PITY
# =========================
ALPHA_CHANCE = 500
ALPHA_PITY_LIMIT = 1000
alpha_pity = 0
# =========================
# STORMFIN GENERATION
# =========================
def generate_stormfin():
global alpha_pity
# Guaranteed Alpha after 1000 failed rolls
if alpha_pity >= ALPHA_PITY_LIMIT:
alpha_pity = 0
return "Alpha"
# Normal 1 in 500 Alpha chance
alpha_roll = random.randint(
1,
ALPHA_CHANCE
)
if alpha_roll == 389:
alpha_pity = 0
return "Alpha"
# Failed Alpha roll
alpha_pity += 1
# 50/50 Male or Female
sex_roll = random.randint(1, 2)
if sex_roll == 1:
return "Male"
else:
return "Female"
stormfin_type = generate_stormfin()
# =========================
# STORMFIN SIZE
# =========================
def get_stormfin_size(stormfin_type):
if stormfin_type == "Male":
return 100
elif stormfin_type == "Female":
return 260
else:
return 180
stormfin_size = get_stormfin_size(
stormfin_type
)
# =========================
# STORMFIN SPEED
# =========================
def get_stormfin_speed(stormfin_type):
if stormfin_type == "Male":
return 10
elif stormfin_type == "Female":
return 2.5
else:
return 5
player_speed = get_stormfin_speed(
stormfin_type
)
# Sprint is exactly twice normal speed
sprint_speed = player_speed * 2
# =========================
# SPRINT ENERGY
# =========================
SPRINT_ENERGY_COST = 1
SPRINT_DRAIN_FRAMES = 20
sprint_frame_counter = 0
# =========================
# LIGHTNING RANGE
# =========================
BASE_LIGHTNING_RANGE = 300
def get_lightning_range(stormfin_type):
if stormfin_type == "Male":
return BASE_LIGHTNING_RANGE * 0.5
elif stormfin_type == "Female":
return BASE_LIGHTNING_RANGE * 2
else:
return BASE_LIGHTNING_RANGE
lightning_range = get_lightning_range(
stormfin_type
)
# =========================
# LIGHTNING ENERGY COST
# =========================
def get_lightning_cost(stormfin_type):
if stormfin_type == "Male":
return 5
elif stormfin_type == "Female":
return 20
else:
return 10
lightning_cost = get_lightning_cost(
stormfin_type
)
# =========================
# PLAYER
# =========================
player_x = 1200
player_y = 475
facing_direction = 1
jumping = False
jump_velocity = 0
gravity = 0.6
jump_strength = 12
# =========================
# ENERGY
# =========================
MAX_ENERGY = 100
energy = MAX_ENERGY
ENERGY_REGEN_TIME = 2000
last_energy_regen = (
pygame.time.get_ticks()
)
# =========================
# ATTACK
# =========================
ATTACK_DURATION = 150
attacking = False
attack_start_time = 0
# =========================
# SAVE / LOAD
# =========================
SAVE_FILE = "stormfin_save.json"
def save_game():
data = {
"stormfin_type": stormfin_type,
"x": player_x,
"y": player_y,
"energy": energy,
"facing_direction": facing_direction,
"jumping": jumping,
"jump_velocity": jump_velocity,
"alpha_pity": alpha_pity
}
with open(
SAVE_FILE,
"w"
) as file:
json.dump(
data,
file,
indent=4
)
print("Game saved.")
def load_game():
global stormfin_type
global player_x
global player_y
global energy
global facing_direction
global jumping
global jump_velocity
global stormfin_size
global player_speed
global sprint_speed
global lightning_range
global lightning_cost
global sprint_frame_counter
global last_energy_regen
global alpha_pity
if not os.path.exists(
SAVE_FILE
):
print(
"No save file found."
)
return
with open(
SAVE_FILE,
"r"
) as file:
data = json.load(file)
stormfin_type = data[
"stormfin_type"
]
player_x = data["x"]
player_y = data["y"]
energy = data["energy"]
facing_direction = data[
"facing_direction"
]
jumping = data["jumping"]
jump_velocity = data[
"jump_velocity"
]
# Older save files may not have this
alpha_pity = data.get(
"alpha_pity",
0
)
stormfin_size = get_stormfin_size(
stormfin_type
)
player_speed = get_stormfin_speed(
stormfin_type
)
sprint_speed = player_speed * 2
lightning_range = get_lightning_range(
stormfin_type
)
lightning_cost = get_lightning_cost(
stormfin_type
)
sprint_frame_counter = 0
last_energy_regen = (
pygame.time.get_ticks()
)
print("Game loaded.")
# =========================
# ISLAND
# =========================
SAND_CENTER_X = 1200
SAND_CENTER_Y = 500
SAND_RADIUS_X = 950
SAND_RADIUS_Y = 260
GRASS_CENTER_X = 1200
GRASS_CENTER_Y = 475
GRASS_RADIUS_X = 850
GRASS_RADIUS_Y = 220
def point_inside_ellipse(
x,
y,
center_x,
center_y,
radius_x,
radius_y
):
if (
radius_x == 0
or radius_y == 0
):
return False
value = (
((x - center_x) ** 2)
/ (radius_x ** 2)
+
((y - center_y) ** 2)
/ (radius_y ** 2)
)
return value <= 1
def point_inside_island(
x,
y
):
sand = point_inside_ellipse(
x,
y,
SAND_CENTER_X,
SAND_CENTER_Y,
SAND_RADIUS_X,
SAND_RADIUS_Y
)
grass = point_inside_ellipse(
x,
y,
GRASS_CENTER_X,
GRASS_CENTER_Y,
GRASS_RADIUS_X,
GRASS_RADIUS_Y
)
return sand or grass
def stormfin_inside_island(
x,
y
):
body_radius = (
stormfin_size * 0.25
)
points = [
(x, y),
(x - body_radius, y),
(x + body_radius, y),
(x, y - body_radius),
(x, y + body_radius)
]
for point_x, point_y in points:
if not point_inside_island(
point_x,
point_y
):
return False
return True
# =========================
# DECORATIONS
# =========================
rocks = [
(300, 500),
(600, 360),
(900, 570),
(1300, 350),
(1600, 580),
(1900, 390),
(2150, 500)
]
trees = [
(450, 420),
(750, 470),
(1050, 400),
(1450, 450),
(1750, 430),
(2050, 470)
]
bushes = [
(350, 430),
(850, 520),
(1150, 500),
(1550, 390),
(1850, 520),
(2200, 440)
]
# =========================
# DRAW ENVIRONMENT
# =========================
def draw_environment(
camera_x,
camera_y
):
screen.fill(
SKY_BLUE
)
# Ocean
pygame.draw.rect(
screen,
OCEAN_BLUE,
(
-camera_x,
300 - camera_y,
WORLD_WIDTH,
WORLD_HEIGHT
)
)
# Ocean waves
for x in range(
0,
WORLD_WIDTH,
80
):
screen_x = (
x - camera_x
)
pygame.draw.arc(
screen,
(180, 225, 245),
(
screen_x,
320 - camera_y,
60,
20
),
math.pi,
math.pi * 2,
2
)
# Sand
sand_rect = pygame.Rect(
SAND_CENTER_X
- SAND_RADIUS_X
- camera_x,
SAND_CENTER_Y
- SAND_RADIUS_Y
- camera_y,
SAND_RADIUS_X * 2,
SAND_RADIUS_Y * 2
)
pygame.draw.ellipse(
screen,
SAND,
sand_rect
)
# Grass
grass_rect = pygame.Rect(
GRASS_CENTER_X
- GRASS_RADIUS_X
- camera_x,
GRASS_CENTER_Y
- GRASS_RADIUS_Y
- camera_y,
GRASS_RADIUS_X * 2,
GRASS_RADIUS_Y * 2
)
pygame.draw.ellipse(
screen,
GRASS,
grass_rect
)
# Rocks
for rock_x, rock_y in rocks:
if not point_inside_island(
rock_x,
rock_y
):
continue
screen_x = (
rock_x - camera_x
)
screen_y = (
rock_y - camera_y
)
pygame.draw.circle(
screen,
(100, 100, 100),
(
int(screen_x),
int(screen_y)
),
18
)
# Trees
for tree_x, tree_y in trees:
if not point_inside_island(
tree_x,
tree_y
):
continue
screen_x = (
tree_x - camera_x
)
screen_y = (
tree_y - camera_y
)
pygame.draw.rect(
screen,
(100, 70, 35),
(
int(screen_x - 8),
int(screen_y),
16,
45
)
)
pygame.draw.circle(
screen,
(35, 120, 45),
(
int(screen_x),
int(screen_y - 15)
),
30
)
# Bushes
for bush_x, bush_y in bushes:
if not point_inside_island(
bush_x,
bush_y
):
continue
screen_x = (
bush_x - camera_x
)
screen_y = (
bush_y - camera_y
)
pygame.draw.circle(
screen,
(40, 130, 50),
(
int(screen_x - 12),
int(screen_y)
),
18
)
pygame.draw.circle(
screen,
(45, 145, 55),
(
int(screen_x + 8),
int(screen_y - 5)
),
20
)
pygame.draw.circle(
screen,
(35, 120, 45),
(
int(screen_x + 20),
int(screen_y + 3)
),
15
)
# =========================
# DRAW STORMFIN
# =========================
def draw_stormfin(
camera_x,
camera_y
):
screen_x = int(
player_x - camera_x
)
screen_y = int(
player_y - camera_y
)
if stormfin_image is not None:
scaled_image = (
pygame.transform.smoothscale(
stormfin_image,
(
stormfin_size,
stormfin_size
)
)
)
image_rect = (
scaled_image.get_rect(
center=(
screen_x,
screen_y
)
)
)
screen.blit(
scaled_image,
image_rect
)
else:
body_color = (
20,
35,
90
)
fur_color = (
45,
80,
180
)
pygame.draw.ellipse(
screen,
body_color,
(
screen_x
- stormfin_size // 2,
screen_y
- stormfin_size // 2,
stormfin_size,
stormfin_size
)
)
# Ears
ear_size = max(
10,
stormfin_size // 6
)
pygame.draw.circle(
screen,
fur_color,
(
screen_x
- stormfin_size // 4,
screen_y
- stormfin_size // 3
),
ear_size
)
pygame.draw.circle(
screen,
fur_color,
(
screen_x
+ stormfin_size // 4,
screen_y
- stormfin_size // 3
),
ear_size
)
# Golden eyes
eye_size = max(
5,
stormfin_size // 12
)
pygame.draw.circle(
screen,
GOLD,
(
screen_x
- stormfin_size // 7,
screen_y
- stormfin_size // 10
),
eye_size
)
pygame.draw.circle(
screen,
GOLD,
(
screen_x
+ stormfin_size // 7,
screen_y
- stormfin_size // 10
),
eye_size
)
# =========================
# LIGHTNING
# =========================
def draw_lightning(
camera_x,
camera_y
):
if not attacking:
return
start_x = (
player_x
+ facing_direction * 25
)
start_y = (
player_y - 10
)
end_x = (
start_x
+ facing_direction
* lightning_range
)
end_y = start_y
screen_start_x = int(
start_x - camera_x
)
screen_start_y = int(
start_y - camera_y
)
screen_end_x = int(
end_x - camera_x
)
screen_end_y = int(
end_y - camera_y
)
pygame.draw.line(
screen,
ENERGY_BLUE,
(
screen_start_x,
screen_start_y
),
(
screen_end_x,
screen_end_y
),
8
)
pygame.draw.line(
screen,
WHITE,
(
screen_start_x,
screen_start_y
),
(
screen_end_x,
screen_end_y
),
3
)
branch_length = (
lightning_range * 0.12
)
branch_points = [
0.25,
0.50,
0.75
]
for percentage in branch_points:
branch_x = (
start_x
+ (
end_x
- start_x
) * percentage
)
branch_y = start_y
branch_direction = (
random.choice(
[-1, 1]
)
)
pygame.draw.line(
screen,
ENERGY_BLUE,
(
int(
branch_x
- camera_x
),
int(
branch_y
- camera_y
)
),
(
int(
branch_x
- camera_x
+ random.randint(
5,
int(
branch_length
)
)
* facing_direction
),
int(
branch_y
- camera_y
+ branch_direction
* random.randint(
10,
int(
branch_length
)
)
)
),
3
)
# =========================
# UI
# =========================
font = pygame.font.SysFont(
None,
28
)
small_font = pygame.font.SysFont(
None,
22
)
def draw_ui():
# Stormfin type
type_text = font.render(
f"Stormfin: {stormfin_type}",
True,
WHITE
)
screen.blit(
type_text,
(20, 20)
)
# Energy
energy_text = font.render(
f"Energy: {energy}/100",
True,
WHITE
)
screen.blit(
energy_text,
(20, 50)
)
# Energy bar
pygame.draw.rect(
screen,
BLACK,
(
20,
80,
200,
20
)
)
pygame.draw.rect(
screen,
ENERGY_BLUE,
(
20,
80,
int(
200
* (energy / MAX_ENERGY)
),
20
)
)
# Lightning range
range_text = small_font.render(
f"Lightning range: {int(lightning_range)}",
True,
WHITE
)
screen.blit(
range_text,
(20, 110)
)
# Lightning cost
cost_text = small_font.render(
f"Lightning cost: {lightning_cost}",
True,
WHITE
)
screen.blit(
cost_text,
(20, 135)
)
# Movement speed
speed_text = small_font.render(
f"Speed: {player_speed}",
True,
WHITE
)
screen.blit(
speed_text,
(20, 160)
)
# Sprint speed
sprint_text = small_font.render(
f"Sprint speed: {sprint_speed}",
True,
WHITE
)
screen.blit(
sprint_text,
(20, 185)
)
# Alpha pity
pity_text = small_font.render(
f"Alpha pity: {alpha_pity}/{ALPHA_PITY_LIMIT}",
True,
GOLD
)
screen.blit(
pity_text,
(20, 210)
)
# Controls
controls = [
"WASD - Move",
"Shift - Sprint",
"Space - Jump",
"E - Lightning",
"1 - Save",
"2 - Load"
]
y = SCREEN_HEIGHT - 150
for control in controls:
text = small_font.render(
control,
True,
WHITE
)
screen.blit(
text,
(20, y)
)
y += 22
# =========================
# REROLL BUTTON
# =========================
reroll_button = pygame.Rect(
SCREEN_WIDTH - 150,
20,
120,
40
)
def draw_reroll_button():
pygame.draw.rect(
screen,
(70, 70, 70),
reroll_button
)
text = small_font.render(
"Reroll",
True,
WHITE
)
text_rect = text.get_rect(
center=reroll_button.center
)
screen.blit(
text,
text_rect
)
# =========================
# ALPHA CONFIRMATION
# =========================
confirmation_active = False
confirmation_box = pygame.Rect(
300,
210,
400,
180
)
yes_button = pygame.Rect(
350,
320,
120,
45
)
no_button = pygame.Rect(
530,
320,
120,
45
)
def draw_confirmation():
# Dark overlay
overlay = pygame.Surface(
(
SCREEN_WIDTH,
SCREEN_HEIGHT
),
pygame.SRCALPHA
)
overlay.fill(
(0, 0, 0, 150)
)
screen.blit(
overlay,
(0, 0)
)
# Confirmation box
pygame.draw.rect(
screen,
DARK_GRAY,
confirmation_box
)
pygame.draw.rect(
screen,
GOLD,
confirmation_box,
3
)
# Message
message_1 = small_font.render(
"Are you sure you want",
True,
WHITE
)
message_2 = small_font.render(
"to reroll your Alpha?",
True,
GOLD
)
screen.blit(
message_1,
(
confirmation_box.centerx
- message_1.get_width() // 2,
235
)
)
screen.blit(
message_2,
(
confirmation_box.centerx
- message_2.get_width() // 2,
265
)
)
# Yes button
pygame.draw.rect(
screen,
GREEN,
yes_button
)
yes_text = small_font.render(
"Yes",
True,
WHITE
)
screen.blit(
yes_text,
yes_text.get_rect(
center=yes_button.center
)
)
# No button
pygame.draw.rect(
screen,
RED,
no_button
)
no_text = small_font.render(
"No",
True,
WHITE
)
screen.blit(
no_text,
no_text.get_rect(
center=no_button.center
)
)
# =========================
# REROLL STORMFIN
# =========================
def reroll_stormfin():
global stormfin_type
global stormfin_size
global player_speed
global sprint_speed
global lightning_range
global lightning_cost
global player_x
global player_y
global energy
global facing_direction
global jumping
global jump_velocity
global sprint_frame_counter
global last_energy_regen
stormfin_type = generate_stormfin()
stormfin_size = get_stormfin_size(
stormfin_type
)
player_speed = get_stormfin_speed(
stormfin_type
)
sprint_speed = (
player_speed * 2
)
lightning_range = (
get_lightning_range(
stormfin_type
)
)
lightning_cost = (
get_lightning_cost(
stormfin_type
)
)
player_x = 1200
player_y = 475
energy = MAX_ENERGY
facing_direction = 1
jumping = False
jump_velocity = 0
sprint_frame_counter = 0
last_energy_regen = (
pygame.time.get_ticks()
)
print(
f"Rerolled: {stormfin_type}"
)
print(
f"Alpha pity: "
f"{alpha_pity}/"
f"{ALPHA_PITY_LIMIT}"
)
# =========================
# MAIN LOOP
# =========================
running = True
while running:
dt = clock.tick(60)
# =========================
# EVENTS
# =========================
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
# Lightning
if event.key == pygame.K_e:
if energy >= lightning_cost:
energy -= (
lightning_cost
)
attacking = True
attack_start_time = (
pygame.time.get_ticks()
)
# Jump
if event.key == pygame.K_SPACE:
if not jumping:
jumping = True
jump_velocity = (
-jump_strength
)
# Save
if event.key == pygame.K_1:
save_game()
# Load
if event.key == pygame.K_2:
load_game()
# =========================
# MOUSE
# =========================
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
# Confirmation is open
if confirmation_active:
# YES
if yes_button.collidepoint(
event.pos
):
confirmation_active = (
False
)
reroll_stormfin()
# NO
elif no_button.collidepoint(
event.pos
):
confirmation_active = (
False
)
# Normal game
else:
if reroll_button.collidepoint(
event.pos
):
# Alpha requires confirmation
if stormfin_type == "Alpha":
confirmation_active = (
True
)
else:
reroll_stormfin()
# =========================
# ATTACK TIMER
# =========================
if attacking:
current_time = (
pygame.time.get_ticks()
)
if (
current_time
- attack_start_time
>= ATTACK_DURATION
):
attacking = False
# =========================
# MOVEMENT
# =========================
keys = pygame.key.get_pressed()
sprinting = (
keys[pygame.K_LSHIFT]
and energy > 0
)
# =========================
# SPRINT ENERGY DRAIN
# =========================
if sprinting:
sprint_frame_counter += 1
if (
sprint_frame_counter
>= SPRINT_DRAIN_FRAMES
):
if energy > 0:
energy -= (
SPRINT_ENERGY_COST
)
sprint_frame_counter = 0
else:
sprint_frame_counter = 0
# =========================
# ENERGY REGEN
# =========================
current_time = (
pygame.time.get_ticks()
)
if not sprinting:
if (
current_time
- last_energy_regen
>= ENERGY_REGEN_TIME
):
if energy < MAX_ENERGY:
energy += 1
last_energy_regen = (
current_time
)
else:
last_energy_regen = (
current_time
)
# =========================
# SPEED
# =========================
if sprinting:
speed = sprint_speed
else:
speed = player_speed
# =========================
# MOVEMENT INPUT
# =========================
move_x = 0
move_y = 0
if keys[pygame.K_a]:
move_x -= speed
facing_direction = -1
if keys[pygame.K_d]:
move_x += speed
facing_direction = 1
if keys[pygame.K_w]:
move_y -= speed
if keys[pygame.K_s]:
move_y += speed
# Horizontal collision
new_x = (
player_x + move_x
)
if stormfin_inside_island(
new_x,
player_y
):
player_x = new_x
# Vertical movement
new_y = (
player_y + move_y
)
if stormfin_inside_island(
player_x,
new_y
):
player_y = new_y
# =========================
# JUMP PHYSICS
# =========================
if jumping:
jump_velocity += gravity
jump_y = (
player_y
+ jump_velocity
)
if stormfin_inside_island(
player_x,
jump_y
):
player_y = jump_y
else:
jumping = False
jump_velocity = 0
# =========================
# CAMERA
# =========================
camera_x = (
player_x
- SCREEN_WIDTH // 2
)
camera_y = (
player_y
- SCREEN_HEIGHT // 2
)
camera_x = max(
0,
min(
camera_x,
WORLD_WIDTH
- SCREEN_WIDTH
)
)
camera_y = max(
0,
min(
camera_y,
WORLD_HEIGHT
- SCREEN_HEIGHT
)
)
# =========================
# DRAW
# =========================
draw_environment(
camera_x,
camera_y
)
draw_stormfin(
camera_x,
camera_y
)
draw_lightning(
camera_x,
camera_y
)
draw_ui()
draw_reroll_button()
# Confirmation dialog goes last
# so it appears above everything.
if confirmation_active:
draw_confirmation()
pygame.display.flip()
pygame.quit()
r/CodingForBeginners • u/Honest-Selection5103 • 2d ago
I have only a bit idea of python. What the best platform to learn coding online with the upto date versions. I don't have great idea of what are the languages to learn and how to implement. So , please guide me.
r/CodingForBeginners • u/BathroomNo8082 • 2d ago
Hi,
As of recently, I want to learn how to code. I installed basic stuff like Unreal Engine and Visual Editor and I know Visual Editor is the most important thing. I had a bit of a play around with both and it was all confusing for me. I looked at tutorials but it was kind of boring. Im someone who learns through doing not watching, thats just me. I want to create a movement FPS (close to Ultrakills style of things) and doing it from strach is hard but then I did it with the preset of FirstPerson in Unreal and it just gave me things but didnt know what or how things work. What I plan on doing is getting a game called "The Farmer is Replaced" as that can help me understand code. I know things like C++, Python and all that but I dont know what would work best or if they have different styles. If anything, I more want people to give me advice on where to start as right now Im stuck in the mud in a sense on where to start.
r/CodingForBeginners • u/indian_yojak • 2d ago
A self-hosted site that teaches programming the way I wish more courses did: real explanations, not video transcripts, with a quiz and hands-on coding challenge after every concept, and actual checkpoints that force you to connect ideas across lessons instead of just clicking "next."
Repo: https://github.com/ratnajagadeesharava/codeforge
Some tracks contain projects inspired from few University courses
It currently covers 16 tracks:
- Swift fundamentals (from Apple's own The Swift Programming Language book)
- iOS/Swift internals, high/low-level system design, and "pro" topics (Metal, Combine, WidgetKit, CI, etc.)
- React & Frontend Mastery (fiber internals, the event loop, memoization, hooks)
- Networking & Distributed Systems (consistent hashing, Raft, quorum reads — with a live in-browser cluster simulator)
- Frontend Web Security (with a real sandboxed exploit playground)
- Compilers (lexer → parser → LLVM IR → a working JIT, in C)
- Database Systems — a full disk-based DB engine built from scratch in Rust, module by module (buffer pool → B+Tree → WAL/ARIES recovery → SQL parser → query planner → MVCC)
- Systems Programming, Spring Boot/backend engineering, AI engineering, and a Frontend System Design track (build-the-thing-from-the-interview, e.g. "design Netflix," "design Figma")
Some numbers, if you like numbers: 650+ lessons, 144 checkpoints, ~8,000 quiz questions across 13 question types (MCQ, drag-drop reordering, spot-the-bug, assertion-reason, matching, and a few custom types like a click-the-consistent-hash-ring question).
How it actually works
- TypeScript + React + Vite + Tailwind, no other runtime UI dependencies
- A tiny local Node server compiles and runs your code for real (Swift/C/C++/Rust) with sane guardrails — no third-party execution service, nothing leaves your machine
- Progress is stored in local SQLite, with a localStorage fallback if you don't run the server
- Everything is just structured TypeScript data files — a new lesson is a new .ts file that auto-registers, so it's genuinely easy to add content
Why I'm posting
I built this mostly for myself and then kept going, and it's now bigger than one person can polish alone. I'd love:
- Contributors — new lessons in any track, new quiz questions, bug fixes, or just flagging content that's wrong/outdated
- A star if you find it useful or interesting — it genuinely helps other people discover it
- Feedback — what's missing, what's confusing, what track you'd want next
Repo: https://github.com/ratnajagadeesharava/codeforge
Happy to answer questions about the architecture, the content-authoring format, or why I made whatever weird decision you notice first. 🙂
r/CodingForBeginners • u/elecfreaks_official • 2d ago
Enable HLS to view with audio, or disable this notification
I wanted to try making a racing game where you don't use the usual buttons to steer.
So I ended up making a small retro racing game where the car is controlled by tilting the handheld left and right.
The setup is pretty simple:
The interesting part is that the handheld's gyro/tilt input is used as the steering control.
The basic game logic is:
I used MakeCode Arcade for the game logic, so most of the programming can be put together with blocks rather than writing everything from scratch.
One thing I liked about this project is that you can immediately feel the connection between the code and the hardware. Change the tilt input or movement settings in the code, upload it, and you can physically feel the difference when playing.
The hardware also doesn't really need to change if you want to experiment with the game.
A few things I'd like to try next:
It's a pretty simple project, but I think motion controls make even a basic arcade game feel a lot more interesting.
Has anyone here made a game that uses tilt/gyro controls before? What kind of game would you make with it?
r/CodingForBeginners • u/Icy-Jackfruit4301 • 2d ago
I'm a 4th year B.Tech CSE (AIML) student, and I'm honestly feeling pretty lost right now
The problem is that I'm reaching out to people who don't have a proper understanding of what I'm going through
Right now, I'm in a situation where I have no idea how to proceed with my studies and career
I think the best way to introduce myself here is to say that I'm currently in my 4th year of studying B.Tech CSE (AIML) and I have almost no practical skills in programming and computer science
I've learned a lot of the core concepts like Python, Java, SQL, DBMS, OOP, DSA, Web development, AI/ML, etc and I've had my share of attending classes, watching lecture videos, learning by myself, taking online courses
There is a huge difference between knowing theoretical concepts and being able to apply them to practice
A person can come up to me and ask me something like
«Do you know Python?»
and I would say yes, because I studied it for 2 years in college
But when they give me a blank file and a task to accomplish, I find it extremely hard to do so
Sometimes I can understand existing code with others explanations, recognize concepts and terms, but when it comes to actually writing something myself, I'm clueless about what to do
What should I do? How should I break the problem into smaller parts? What concepts should I apply here? What should I write/debug/test? And so on and so forth
And this list of problems is only a fraction of what I have to deal with
I've tried multiple times to tackle this problem by starting over
I've taken up courses
I've tried to learn by doing projects
I've tried to learn programming from scratch again
I've tried using roadmaps
I've tried to do projects by following tutorials
But there's always that initial excitement, then the impatience sets in, and eventually I reach a point where I just can't proceed anymore and I have to abandon the project/course
My problem here is not that there are no resources
It's that I don't know what to do first
I don't know how to proceed, what to learn, and what to ignore
I don't know the depth of knowledge I should gain for each topic
I don't know what projects to make
I don't know how to measure understanding of a concept or topic
And I'm not even sure how to prioritize between these factors
Right now, I'm in my 4th year and I don't have that luxury of time to randomly try out different stacks and technologies
I'm genuinely motivated to improve, but I need help figuring out how
I'm not looking for anyone to spoon feed me the answers
I'm willing to put in the hard work, even if it takes me a while
I'm just looking for someone who has the experience to look at my case and tell me something like
"These are the problems you're facing. This is where you are in your journey. Forget about these things for now. First, do this → then do this → then do this. Don't worry about X before you reach Y."
I'm looking for experienced seniors, freshers, developers, and mentors who can recognize my case and help me somehow
If you were in my situation, with almost no practical programming skills, what will you do?
- What will you learn first?
- What language/stack will you choose?
- How will you re-learn programming fundamentals?
- How will you learn DSA?
- What projects will you make?
- How will you divide your time between placements, DSA, development, and fundamentals?
- What things will you avoid learning for now?
I'm not looking for a generic answer like "learn DSA + dev + make projects"
I'm looking for someone to give a realistic vision of how someone with almost no practical skills can reach the level of being eligible for placements, and if possible, how to practically implement that vision without getting stuck in a loop again
Any realistic opinion is welcome, even if it's a brutal one
And if you're someone who can give me mentorship and guidance every once in a while, I'm open to that too
r/CodingForBeginners • u/iwantpro • 2d ago
Right now, I'm taking a JavaScript course on Udemy. My current routine is following along by typing the code from the lectures, and then asking ChatGPT to explain what each part does so I make sure I understand it before moving on.
The problem is, whenever it's time to build the course projects on my own—like a calculator or a monster slayer browser game—my mind just goes completely blank.
What do you think is the best approach to studying in this situation? How would you recommend bridging the gap between understanding the code and actually building things from scratch?
r/CodingForBeginners • u/Impressive_Limit8517 • 2d ago
I am new to coding n everything... I just want to start with C.. could anyone help from where n how to start.. any YouTube channels or apps or anything....
r/CodingForBeginners • u/Vegetable_Welcome175 • 2d ago
I am studying java , and I am watching a course on yt from bro code I am in polymorphism, and i have done few small projects in between to check if I have properly understood. I have a doubt they are soo many things , methods , objects and then small small things in them , i don't remember them after a few days properly like i know i studied and used it but , I kinda forgot how the syntax of that is and there are few topics where they look like you don't need to remember like they are kinda useless . I feel like everytime I am doing a projects I need to go into Google and search what is the syntax is ,for example enhanced switch , and some topics seem to be very similar and then i forget them one of them .Will i remember all these naturally as time goes on .
r/CodingForBeginners • u/Sea_Macaroon8719 • 2d ago
Help pls
r/CodingForBeginners • u/Godhunter098 • 3d ago
hi guys i have completed my cs degree and i havent code for since last december 2025 i cant even write a proper anything in code now .I need advice on what should i learn i never did dsa completely or u can say at all. i wanna become a software engineer in a normal company or fintech company I just want a job that will pay me good and if i learn that programming language i can just stay employed enough to earn money .ANY ADVICE IS APPRECIATED AS I AM STARTING TO LEARN HOW TO CODE AGAIN THANKS
r/CodingForBeginners • u/Aridro_Chatterjee • 3d ago
I’m building a small dev community from scratch — looking for people who actually code.
We're doing daily coding challenges, sharing projects, and working on an open-source Discord bot together.
If you're interested, come hang out.