diff --git "a/app.py" "b/app.py" --- "a/app.py" +++ "b/app.py" @@ -7,708 +7,734 @@ import random import time import math -# --- SERVER CONFIGURATION --- +--- SERVER CONFIGURATION --- + WIDTH = 375 HEIGHT = 812 -app = Flask(__name__) +app = Flask(name) app.config['SECRET_KEY'] = 'jungle_jump_pro_2024' socketio = SocketIO(app, async_mode='eventlet', cors_allowed_origins='*') -# --- GAME STATE --- +--- GAME STATE --- + players = {} platforms = [] collectibles = [] enemies = [] highest_y_generated = HEIGHT -game_events = [] # For broadcasting special events +game_events = [] # For broadcasting special events def generate_platform(y_pos, difficulty=1): - p_type = 'normal' - vx = 0 - special = None - - rand = random.random() - if rand < 0.15: - p_type = 'bouncy' - elif rand < 0.25: - p_type = 'ice' - elif rand < 0.32: - p_type = 'crumbling' - elif rand < 0.38: - p_type = 'cloud' - elif rand < 0.42: - p_type = 'golden' - - if random.random() < 0.25: - vx = (2 + difficulty * 0.5) if random.random() > 0.5 else -(2 + difficulty * 0.5) - - # Special items on platform - if random.random() < 0.08: - special = 'spring' - elif random.random() < 0.05: - special = 'jetpack' - elif random.random() < 0.04: - special = 'shield' - elif random.random() < 0.03: - special = 'magnet' - - return { - 'id': int(time.time() * 1000) + random.randint(0, 9999), - 'x': random.random() * (WIDTH - 70), - 'y': y_pos, - 'w': 70 if p_type != 'cloud' else 90, - 'h': 18, - 'type': p_type, - 'vx': vx, - 'special': special, - 'broken': False, - 'wobble': 0 - } +p_type = 'normal' +vx = 0 +special = None + +code +Code +download +content_copy +expand_less +rand = random.random() +if rand < 0.15: + p_type = 'bouncy' +elif rand < 0.25: + p_type = 'ice' +elif rand < 0.32: + p_type = 'crumbling' +elif rand < 0.38: + p_type = 'cloud' +elif rand < 0.42: + p_type = 'golden' + +if random.random() < 0.25: + vx = (2 + difficulty * 0.5) if random.random() > 0.5 else -(2 + difficulty * 0.5) + +# Special items on platform +if random.random() < 0.08: + special = 'spring' +elif random.random() < 0.05: + special = 'jetpack' +elif random.random() < 0.04: + special = 'shield' +elif random.random() < 0.03: + special = 'magnet' + +return { + 'id': int(time.time() * 1000) + random.randint(0, 9999), + 'x': random.random() * (WIDTH - 70), + 'y': y_pos, + 'w': 70 if p_type != 'cloud' else 90, + 'h': 18, + 'type': p_type, + 'vx': vx, + 'special': special, + 'broken': False, + 'wobble': 0 +} def generate_collectible(y_pos): - c_type = 'coin' if random.random() > 0.15 else 'gem' - return { - 'id': int(time.time() * 1000) + random.randint(0, 9999), - 'x': random.random() * (WIDTH - 30), - 'y': y_pos - 50, - 'type': c_type, - 'collected': False, - 'value': 10 if c_type == 'coin' else 50 - } +c_type = 'coin' if random.random() > 0.15 else 'gem' +return { +'id': int(time.time() * 1000) + random.randint(0, 9999), +'x': random.random() * (WIDTH - 30), +'y': y_pos - 50, +'type': c_type, +'collected': False, +'value': 10 if c_type == 'coin' else 50 +} def generate_enemy(y_pos): - e_type = random.choice(['slime', 'bat', 'spike']) - return { - 'id': int(time.time() * 1000) + random.randint(0, 9999), - 'x': random.random() * (WIDTH - 40), - 'y': y_pos - 80, - 'type': e_type, - 'vx': 2 if random.random() > 0.5 else -2, - 'active': True - } +e_type = random.choice(['slime', 'bat', 'spike']) +return { +'id': int(time.time() * 1000) + random.randint(0, 9999), +'x': random.random() * (WIDTH - 40), +'y': y_pos - 80, +'type': e_type, +'vx': 2 if random.random() > 0.5 else -2, +'active': True +} def init_world(): - global platforms, collectibles, enemies, highest_y_generated - platforms = [] - collectibles = [] - enemies = [] - - # Base platform - platforms.append({ - 'id': 0, 'x': WIDTH/2 - 50, 'y': HEIGHT - 150, - 'w': 100, 'h': 20, 'type': 'start', 'vx': 0, - 'special': None, 'broken': False, 'wobble': 0 - }) +global platforms, collectibles, enemies, highest_y_generated +platforms = [] +collectibles = [] +enemies = [] + +code +Code +download +content_copy +expand_less +# Base platform +platforms.append({ + 'id': 0, 'x': WIDTH/2 - 50, 'y': HEIGHT - 150, + 'w': 100, 'h': 20, 'type': 'start', 'vx': 0, + 'special': None, 'broken': False, 'wobble': 0 +}) + +y = HEIGHT - 280 +for i in range(300): + difficulty = min(i / 50, 5) + gap = 75 + random.random() * (35 + difficulty * 5) + platforms.append(generate_platform(y, difficulty)) - y = HEIGHT - 280 - for i in range(300): - difficulty = min(i / 50, 5) - gap = 75 + random.random() * (35 + difficulty * 5) - platforms.append(generate_platform(y, difficulty)) - - if random.random() < 0.4: - collectibles.append(generate_collectible(y)) - - if random.random() < 0.08 and i > 10: - enemies.append(generate_enemy(y)) - - y -= gap + if random.random() < 0.4: + collectibles.append(generate_collectible(y)) + + if random.random() < 0.08 and i > 10: + enemies.append(generate_enemy(y)) - highest_y_generated = y + y -= gap + +highest_y_generated = y init_world() -# --- ENHANCED HTML TEMPLATE --- +--- ENHANCED HTML TEMPLATE --- + HTML_TEMPLATE = """ + + - - - 🌴 Jungle Jump Pro - Multiplayer - - + + +🌴 Jungle Jump Pro - Multiplayer + +
- - - -
- -
✨ Multiplayer Pro Edition ✨
- -
-
🦖
-
🐸
-
🐱
-
🤖
-
👽
-
- - - - - + + +code +Code +download +content_copy +expand_less + +
+ +
✨ Multiplayer Pro Edition ✨
+ +
+
🦖
+
🐸
+
🐱
+
🤖
+
👽
- - - -
x2 COMBO!
+ + - - + + +