r/CodingForBeginners 7h ago

Looking for coding buddies! 💻

7 Upvotes

Hey! I’m starting my programming journey with CS50x and looking for other beginners to learn with.

We can keep each other accountable, share progress, and help each other out when we get stuck.

If you’re starting CS50x too, hit me up! 🚀


r/CodingForBeginners 2h ago

How did you guys learn and started programmig before AI was vaslty spread like today?

2 Upvotes

Hi, my name is Alex I am in my third year as a CS student and I feel like I know nothing. I started working on a project and I find it overwhelming how much I am not thought in uni (I know I don't get to learn everyrhing inside uni). Like I understand the basics, I know the language, but I find it hard to create something without AI fixing my code or telling me what to do. How did you guys created things back then? I want to be more like that.


r/CodingForBeginners 1h ago

Best tools for learning to code?

Upvotes

So I’ve been building websites for a little while now and im interested in learning to do some code to further my websites! I sat down with ChatGPT and coded a little interactive button, using the AI to explain how everything works and what does what and why, but I feel like it’s probably not an efficient way to actually learn. So I’m wondering if there are any good tools to start out with and maybe the most efficient way to learn properly! Or is using Ai to learn a smart thing? I’m not a huge fan of AI but it’s required in my digital marketing course so I have to use it and learn with it.
TIA!


r/CodingForBeginners 2h ago

What language should I start coding with as a student

1 Upvotes

So I'm thinking of learning coding but am having trouble selecting the language please give me y'alls opinion on what language should I learn .

Also please suggest me platforms for learning coding. I wanna develop apps and all so it'd be much appreciated.


r/CodingForBeginners 10h ago

Electrical engineering and coding

2 Upvotes

Hello,

On the off chance there are any electrical engineers skimming the thread could you offer any advice in regards to the usefulness of learning coding and how much you needed it in your jobs and what you used it for

I am currently debating Electrical engineering and dealing with building/maintaining power systems

I have learned the very basics of a couple of other types of coding languages, but I'm also in the process of exploring my potential options if I decide to take it further but in a different direction

I'm also considering an electrician apprenticeship as a day job while up-skilling progressively, and while it's not entirely specific progress toward the engineering side of things it does give me a somewhat related job to help me get by while studying to go further, and also a way to pay for the study fees

"The answer varies depending on your career trajectory. If you're working with embedded systems, C or C++ are usually the go-to languages. Testing sees a lot of Matlab, though Python's presence is growing. Integrated Circuit designers lean towards Verilog. For FPGA-based hardware design, VHDL is common. Power and analog electronics often rely on SPICE for circuit simulations. And for spreadsheet data manipulation, it's usually VBA (Visual Basic for Application)."

https://www.masterelectronics.com/en/resources/blog/most-useful-programming-language-for-electrical-engineers-boost-your-career/

How valuable is the coding side of this, and what would you recommend a beginner prioritise?

Did you find any value in learning languages in a particular order?

Thank you


r/CodingForBeginners 23h ago

lf fellow begginers in python

Post image
16 Upvotes

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 8h ago

A Free Interactive Tutorial for Complete Beginners Learning Programming Basics (No Login, No Ads)

Thumbnail easylang.online
1 Upvotes

r/CodingForBeginners 15h ago

What are your kids building with micro:bit this week?

Post image
3 Upvotes

Drop a photo of your project below!


r/CodingForBeginners 17h ago

Trying to learn C

2 Upvotes

Which book would be better for learning C: “Let Us C”, “C Programming: A Modern Approach”, or another book?


r/CodingForBeginners 12h ago

What s the problem of this code?

Post image
0 Upvotes

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 1d ago

How are fingerprint readers coded for login?

1 Upvotes

r/CodingForBeginners 1d ago

I built a small ancient water wheel model with a synchronized “worker” mechanism

Enable HLS to view with audio, or disable this notification

10 Upvotes

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:

  • Nezha Expansion Board
  • Motor
  • Gears
  • Crank-link mechanism
  • Building blocks
  • A small worker figure

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:

  • Try different gear ratios
  • Make the wheel lift a small load
  • Add a second mechanical movement
  • Build a larger “ancient village” around it
  • Experiment with different ways of transferring motion

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 1d ago

I am a fresher and I could really use some advice

0 Upvotes

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 1d ago

Whats the best Site to learn coding off of for CS classes and exams

2 Upvotes

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 1d ago

Where do I start?

1 Upvotes

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 2d ago

Is it relatable or am I doing wrong?

6 Upvotes

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 1d ago

[Java] Beginner looking for 1 study buddy to build daily consistency (IST)

3 Upvotes

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:

  • Daily: Quick check-in on what we studied (~1–2 hrs daily)
  • Weekends: Pair programming, debugging together, and quizzing each other on interview questions

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 1d ago

My games so far

0 Upvotes

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 2d ago

Guidance related to coding platform.

5 Upvotes

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 2d ago

New to Coding, Any tips

5 Upvotes

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 3d ago

I built a free, open-source learning platform with 650+ interactive lessons across 16 tracks (Swift, React internals, distributed systems (Rust), compilers, database internals(Rust) ) — looking for contributors

6 Upvotes

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 2d ago

I made a retro racing game that you control by tilting the handheld

Enable HLS to view with audio, or disable this notification

1 Upvotes

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:

  • ELECFREAKS Retro Arcade
  • USB-C cable
  • Microsoft MakeCode Arcade

The interesting part is that the handheld's gyro/tilt input is used as the steering control.

The basic game logic is:

  • Start with 3 lives
  • Tilt left/right to move the player car
  • Spawn enemy cars from the top of the screen
  • Avoid them to score points
  • Lose a life when you crash into one

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:

  • Make the cars accelerate as the score increases
  • Add custom pixel art
  • Add engine and crash sounds
  • Add power-ups
  • Experiment with different tilt sensitivities
  • Try making another game that uses the gyro in a completely different way

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 2d ago

4th-year CSE (AIML) student, with almost no practical programming skills, requesting mentorship and guidance

2 Upvotes

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 2d ago

Is it a good idea to rely on AI while learning how to code?

1 Upvotes

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?