找回密码
 中文实名注册
搜索
查看: 5|回复: 0

《炼狱残痕》 (上)

[复制链接]

12

主题

109

回帖

1131

积分

金牌会员

积分
1131
发表于 昨天 20:49 | 显示全部楼层 |阅读模式
import pygame
import random
import sys

pygame.init()
WIDTH = 800
HEIGHT = 500
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("炼狱残痕|全新地狱横版闯关")

# ===== 地狱色调配色 =====
BG_DARK = (32, 12, 16)
BG_RED = (70, 18, 24)
PLATFORM_STATIC = (80, 70, 66)
PLATFORM_TOP = (140, 50, 42)
PLATFORM_CRUMBLE = (110, 80, 60)
SPIKE_COLOR = (10, 10, 10)
LASER_COLOR = (220, 20, 20)
PLAYER_MAIN = (50, 160, 220)
PLAYER_OUTLINE = (20, 80, 130)
GROUND_MONSTER = (160, 25, 25)
FLY_MONSTER = (130, 20, 140)
BOUNCE_MONSTER = (220, 120, 0)
WHITE = (255, 255, 255)
RED = (230, 20, 20)
YELLOW = (255, 210, 0)
BLACK = (0, 0, 0)

# 字体
font = pygame.font.Font(None, 40)
small_font = pygame.font.Font(None, 32)

# 玩家设置(小型碰撞框,无二段跳)
pw = 26
ph = 36
speed = 4.8
gravity = 0.7
jump_power = -13.5

# ==================== 关卡数据(全新陷阱组合) ====================
levels = [
    # 第1关:入门炼狱 碎裂平台+基础尖刺
    {
        "platforms": [
            {"rect":[0, 440, 130, 60], "type":"static"},
            {"rect":[180, 360, 68, 22], "type":"crumble", "timer_max":70},
            {"rect":[310, 290, 65, 22], "type":"static"},
            {"rect":[440, 220, 68, 22], "type":"lift", "mr":70, "msp":1.1},
            {"rect":[570, 150, 70, 22], "type":"static"},
        ],
        "spikes": [
            [145, 418, 36, 22],
            [340, 268, 36, 22],
        ],
        "lasers": [],
        "ground_monsters": [{"x":315,"y":248,"range":42,"speed":1.9}],
        "fly_monsters": [],
        "bounce_monsters": [],
        "finish": [610, 106, 48, 44],
        "start_x": 25,
        "start_y": 350
    },
    # 第2关:新增飞行怪物
    {
        "platforms": [
            {"rect":[0, 440, 105, 60], "type":"static"},
            {"rect":[140, 350, 62, 22], "type":"crumble", "timer_max":65},
            {"rect":[260, 270, 62, 22], "type":"lift", "mr":62, "msp":1.3},
            {"rect":[380, 200, 62, 22], "type":"static"},
            {"rect":[500, 270, 62, 22], "type":"crumble", "timer_max":60},
            {"rect":[620, 190, 66, 22], "type":"static"},
        ],
        "spikes": [
            [110, 418, 36, 22],
            [290, 248, 36, 22],
            [410, 178, 36, 22],
        ],
        "lasers": [],
        "ground_monsters": [{"x":385,"y":158,"range":38,"speed":2.1}],
        "fly_monsters": [{"x":350,"y":130,"range":140,"speed":1.6}],
        "bounce_monsters": [],
        "finish": [655, 146, 48, 44],
        "start_x": 18,
        "start_y": 350
    },
    # 第3关:解锁脉冲激光
    {
        "platforms": [
            {"rect":[0, 440, 90, 60], "type":"static"},
            {"rect":[115, 340, 58, 22], "type":"lift", "mr":58, "msp":1.4},
            {"rect":[230, 260, 58, 22], "type":"crumble", "timer_max":60},
            {"rect":[345, 330, 58, 22], "type":"static"},
            {"rect":[460, 250, 58, 22], "type":"lift", "mr":52, "msp":1.5},
            {"rect":[575, 170, 58, 22], "type":"crumble", "timer_max":55},
            {"rect":[690, 90, 60, 22], "type":"static"},
        ],
        "spikes": [
            [95, 418, 36, 22],
            [260, 238, 36, 22],
            [375, 308, 36, 22],
            [490, 228, 36, 22],
        ],
        "lasers": [{"x":420,"y":120,"height":130,"cycle":110}],
        "ground_monsters": [{"x":350,"y":288,"range":36,"speed":2.3}],
        "fly_monsters": [{"x":480,"y":130,"range":130,"speed":1.8}],
        "bounce_monsters": [],
        "finish": [695, 46, 48, 44],
        "start_x": 14,
        "start_y": 350
    },
    # 第4关:弹跳怪物登场
    {
        "platforms": [
            {"rect":[0, 440, 80, 60], "type":"static"},
            {"rect":[98, 350, 54, 22], "type":"crumble", "timer_max":55},
            {"rect":[203, 270, 54, 22], "type":"lift", "mr":50, "msp":1.6},
            {"rect":[308, 190, 54, 22], "type":"static"},
            {"rect":[413, 270, 54, 22], "type":"crumble", "timer_max":52},
            {"rect":[518, 190, 54, 22], "type":"lift", "mr":46, "msp":1.7},
            {"rect":[623, 110, 56, 22], "type":"static"},
            {"rect":[712, 55, 54, 22], "type":"crumble", "timer_max":50},
        ],
        "spikes": [
            [75, 418, 36, 22],
            [125, 328, 36, 22],
            [230, 248, 36, 22],
            [335, 168, 36, 22],
            [440, 248, 36, 22],
            [545, 168, 36, 22],
        ],
        "lasers": [
            {"x":360,"y":80,"height":110,"cycle":100},
            {"x":560,"y":60,"height":90,"cycle":95}
        ],
        "ground_monsters": [
            {"x":312,"y":148,"range":34,"speed":2.4},
            {"x":628,"y":68,"range":30,"speed":2.5}
        ],
        "fly_monsters": [{"x":430,"y":120,"range":120,"speed":1.9}],
        "bounce_monsters": [{"x":418,"y":228,"range":60,"bounce_spd":3.2}],
        "finish": [718, 12, 48, 44],
        "start_x": 10,
        "start_y": 350
    },
    # 第5关【终焉炼狱:全部陷阱同时登场】
    {
        "platforms": [
            {"rect":[0, 440, 68, 60], "type":"static"},
            {"rect":[85, 340, 48, 22], "type":"lift", "mr":46, "msp":1.7},
            {"rect":[172, 250, 48, 22], "type":"crumble", "timer_max":50},
            {"rect":[259, 330, 48, 22], "type":"static"},
            {"rect":[346, 250, 48, 22], "type":"lift", "mr":42, "msp":1.8},
            {"rect":[433, 170, 48, 22], "type":"crumble", "timer_max":46},
            {"rect":[520, 250, 48, 22], "type":"static"},
            {"rect":[607, 170, 48, 22], "type":"lift", "mr":38, "msp":1.9},
            {"rect":[692, 75, 50, 22], "type":"crumble", "timer_max":44},
        ],
        "spikes": [
            [60, 418, 36, 22],
            [105, 318, 36, 22],
            [190, 228, 36, 22],
            [277, 308, 36, 22],
            [364, 228, 36, 22],
            [451, 148, 36, 22],
            [538, 228, 36, 22],
            [625, 148, 36, 22],
        ],
        "lasers": [
            {"x":320,"y":60,"height":120,"cycle":90},
            {"x":485,"y":50,"height":100,"cycle":85},
            {"x":640,"y":40,"height":85,"cycle":80}
        ],
        "ground_monsters": [
            {"x":176,"y":208,"range":30,"speed":2.6},
            {"x":350,"y":208,"range":28,"speed":2.7},
            {"x":612,"y":128,"range":26,"speed":2.8}
        ],
        "fly_monsters": [
            {"x":300,"y":120,"range":110,"speed":2.0},
            {"x":500,"y":90,"range":100,"speed":2.1}
        ],
        "bounce_monsters": [
            {"x":264,"y":288,"range":55,"bounce_spd":3.4},
            {"x":524,"y":208,"range":52,"bounce_spd":3.3}
        ],
        "finish": [698, 32, 48, 44],
        "start_x": 6,
        "start_y": 350
    }
]


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 中文实名注册

本版积分规则

快速回复 返回顶部 返回列表