frist video doesent show all work 2nd video shows code so far
this was a pygame at frist then it was a website then it was back to a pygame and yes i know there is eorrs and that will be next
the base code is already almost done
import pygame
# --- THE MEGA DATABASE ---
# This stores every character's core "RPG" stats
ALL_CHARACTERS = {
# The Seven of the Prophecy
"Percy": {"parent": "Poseidon", "power": "Hydrokinesis", "hp": 150, "speed": 5, "weapon": "Riptide"},
"Annabeth": {"parent": "Athena", "power": "Strategy", "hp": 100, "speed": 6, "weapon": "Dagger"},
"Jason": {"parent": "Jupiter", "power": "Aerokinesis", "hp": 140, "speed": 5, "weapon": "Ivlix"},
"Piper": {"parent": "Aphrodite","power": "Charmspeak", "hp": 90, "speed": 6, "weapon": "Katoptris"},
"Leo": {"parent": "Hephaestus","power": "Pyrokinesis", "hp": 110, "speed": 6, "weapon": "Tools"},
"Frank": {"parent": "Mars", "power": "Shapeshift", "hp": 180, "speed": 4, "weapon": "Bow"},
"Hazel": {"parent": "Pluto", "power": "Geokinesis", "hp": 120, "speed": 5, "weapon": "Spatha"},
# Major Supporting Characters
"Nico": {"parent": "Hades", "power": "Necromancy", "hp": 100, "speed": 7, "weapon": "Stygian Iron"},
"Thalia": {"parent": "Zeus", "power": "Electrokinesis","hp": 130, "speed": 7, "weapon": "Aegis"},
"Reyna": {"parent": "Bellona", "power": "Lending", "hp": 140, "speed": 5, "weapon": "Spear"},
"Clarisse": {"parent": "Ares", "power": "Strength", "hp": 160, "speed": 4, "weapon": "Maimer"},
"Will": {"parent": "Apollo", "power": "Healing", "hp": 80, "speed": 5, "weapon": "Medical Kit"},
"Grover": {"parent": "Pan", "power": "Nature Magic", "hp": 90, "speed": 6, "weapon": "Reed Pipes"},
"Luke": {"parent": "Hermes", "power": "Thievery", "hp": 140, "speed": 8, "weapon": "Backbiter"}
}
class Demigod(pygame.sprite.Sprite):
def __init__(self, name, position):
super().__init__()
if name not in ALL_CHARACTERS:
name = "Percy" # Default fallback
self.data = ALL_CHARACTERS[name]
self.name = name
# Stat assignment
self.hp = self.data["hp"]
self.speed = self.data["speed"]
self.power = self.data["power"]
# Logic for loading the right image
# Assumes you have images named 'percy.png', 'annabeth.png', etc.
try:
self.image = pygame.image.load(f"assets/sprites/{name.lower()}.png").convert_alpha()
except:
# Create a placeholder colored square if image is missing
self.image = pygame.Surface((50, 50))
self.image.fill((218, 165, 32)) # Bronze/Gold color
self.rect = self.image.get_rect(topleft=position)
def use_ability(self):
print(f"{self.name} uses {self.power}!")
# Add specific ability logic here
import pygame
import sys
# --- SETTINGS & COLORS ---
WIDTH, HEIGHT = 800, 600
WHITE = (255, 255, 255)
GOLD = (218, 165, 32)
DARK_BG = (20, 20, 20)
CHAT_BOX = (40, 40, 40)
YOU_COLOR = (173, 216, 230) # Light Blue
# --- CHARACTER DATA ---
PERSONAS = {
"Percy": {
"greeting": "Hey! Want some blue cookies or a trip to the lake?",
"responses": {
"hello": "Sup! Ready for some training?",
"water": "It’s my favorite element. I feel stronger just thinking about it.",
"annabeth": "She's the smartest person I know. Don't tell her I said that.",
"default": "Haha, totally. Anyway, did you see what Clarisse did today?"
}
},
"Annabeth": {
"greeting": "I'm busy with blueprints, but I have a minute for strategy.",
"responses": {
"hello": "Hello. Do you have a plan for today's Capture the Flag?",
"plan": "A good plan is the difference between victory and the infirmary.",
"percy": "He's a Seaweed Brain, but he's my Seaweed Brain.",
"default": "Interesting... I'll have to research that in the library."
}
}
}
class DemigodChat:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Camp Half-Blood: Conversations")
self.font = pygame.font.SysFont("Georgia", 22)
self.clock = pygame.time.Clock()
self.active_char = "Percy"
self.input_text = ""
self.chat_history = [(self.active_char, PERSONAS[self.active_char]["greeting"])]
self.input_rect = pygame.Rect(50, 530, 700, 40)
def get_ai_response(self, text):
text = text.lower()
persona = PERSONAS[self.active_char]
response = persona["responses"].get("default")
for key in persona["responses"]:
if key in text:
response = persona["responses"][key]
break
return response
def run(self):
while True:
self.screen.fill(DARK_BG)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(); sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
if self.input_text.strip():
# User Message
self.chat_history.append(("You", self.input_text))
# AI Response
reply = self.get_ai_response(self.input_text)
self.chat_history.append((self.active_char, reply))
self.input_text = ""
elif event.key == pygame.K_BACKSPACE:
self.input_text = self.input_text[:-1]
else:
self.input_text += event.unicode
if event.type == pygame.MOUSEBUTTONDOWN:
# Tab Switching (Percy Tab)
if 50 <= event.pos[0] <= 150 and 50 <= event.pos[1] <= 90:
self.active_char = "Percy"
self.chat_history = [(self.active_char, PERSONAS["Percy"]["greeting"])]
# Tab Switching (Annabeth Tab)
elif 160 <= event.pos[0] <= 260 and 50 <= event.pos[1] <= 90:
self.active_char = "Annabeth"
self.chat_history = [(self.active_char, PERSONAS["Annabeth"]["greeting"])]
self.draw()
pygame.display.flip()
self.clock.tick(60)
def draw(self):
# Tabs
p_color = GOLD if self.active_char == "Percy" else CHAT_BOX
a_color = GOLD if self.active_char == "Annabeth" else CHAT_BOX
pygame.draw.rect(self.screen, p_color, (50, 50, 100, 40))
pygame.draw.rect(self.screen, a_color, (160, 50, 100, 40))
self.screen.blit(self.font.render("Percy", True, WHITE), (65, 60))
self.screen.blit(self.font.render("Annabeth", True, WHITE), (165, 60))
# Chat Area
pygame.draw.rect(self.screen, CHAT_BOX, (50, 100, 700, 410))
pygame.draw.rect(self.screen, GOLD, (50, 100, 700, 410), 2)
# Messages
y = 120
for sender, text in self.chat_history[-10:]:
color = YOU_COLOR if sender == "You" else GOLD
txt_surf = self.font.render(f"{sender}: {text}", True, color)
self.screen.blit(txt_surf, (70, y))
y += 40
# Input
pygame.draw.rect(self.screen, WHITE, self.input_rect, 2)
input_surf = self.font.render(self.input_text, True, WHITE)
self.screen.blit(input_surf, (60, 540))
if __name__ == "__main__":
game = DemigodChat()
game.run()
from today project i learned pygame is compulated (hope i spell that right) and that good coders adapts to the callanges that come up and slove it
and i know i do a lot of simulations projects but thats because with each sim i do it gets harder and harder which means i have to adapt to the new challnage
this project isnt close to done but i am going as fast as i can
next week keystones so problly no post
im trying to include a ai chat
the reson for this percy jackson is my favorite book so i know the most about it