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

0.0通关率 (终极地狱难度)上

[复制链接]

12

主题

109

回帖

1131

积分

金牌会员

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

pygame.init()
WIDTH = 800
HEIGHT = 500
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("横版闯关|终极地狱难度")

# 色彩
SKY = (110, 175, 250)
SKY_TOP = (80, 140, 220)
GROUND_TOP = (70, 160, 50)
GROUND_BOTTOM = (92, 64, 42)
PLAYER_MAIN = (45, 155, 235)
PLAYER_OUTLINE = (25, 90, 140)
SPIKE_COLOR = (40, 40, 40)
MONSTER_COLOR = (180, 30, 30)
MONSTER_OUTLINE = (90, 10, 10)
CHASE_MONSTER_COLOR = (140, 20, 160)
CHASE_MONSTER_OUTLINE = (70, 0, 90)
WHITE = (255, 255, 255)
RED = (220, 30, 30)
YELLOW = (255, 220, 0)
BLACK = (0,0,0)

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

# 玩家【缩小尺寸 + 取消二段跳】
pw = 26
ph = 36
speed = 5
gravity = 0.68
jump_power = -14

# ===================== 关卡数据(移动平台+巡逻怪+追踪怪) =====================
levels = [
    # 第1关
    {
        "platforms": [
            {"rect":[0, 440, 140, 60], "move":False},
            {"rect":[190, 360, 70, 22], "move":True,"mr":60,"msp":1.2},
            {"rect":[330, 290, 65, 22], "move":False},
            {"rect":[460, 220, 65, 22], "move":True,"mr":50,"msp":1.4},
            {"rect":[590, 160, 70, 22], "move":False},
        ],
        "spikes": [
            [155, 418, 36, 22],
            [360, 268, 36, 22],
            [520, 198, 36, 22],
        ],
        "monsters": [
            {"type":"patrol","x":200,"y":318,"range":45,"speed":2.0},
        ],
        "chase_monsters":[
            {"x":470,"y":178,"speed":1.6,"detect_range":220}
        ],
        "finish": [630, 116, 48, 44],
        "start_x": 30,
        "start_y": 350
    },
    # 第2关
    {
        "platforms": [
            {"rect":[0, 440, 110, 60], "move":False},
            {"rect":[150, 350, 62, 22], "move":True,"mr":55,"msp":1.4},
            {"rect":[270, 270, 62, 22], "move":False},
            {"rect":[390, 200, 62, 22], "move":True,"mr":50,"msp":1.5},
            {"rect":[510, 270, 62, 22], "move":False},
            {"rect":[630, 200, 68, 22], "move":True,"mr":45,"msp":1.6},
        ],
        "spikes": [
            [120, 418, 36, 22],
            [300, 248, 36, 22],
            [420, 178, 36, 22],
            [540, 248, 36, 22],
        ],
        "monsters": [
            {"type":"patrol","x":160,"y":308,"range":40,"speed":2.2},
            {"type":"patrol","x":520,"y":228,"range":38,"speed":2.3},
        ],
        "chase_monsters":[
            {"x":400,"y":158,"speed":1.8,"detect_range":240}
        ],
        "finish": [665, 156, 48, 44],
        "start_x": 20,
        "start_y": 350
    },
    # 第3关
    {
        "platforms": [
            {"rect":[0, 440, 95, 60], "move":False},
            {"rect":[125, 340, 58, 22], "move":True,"mr":50,"msp":1.5},
            {"rect":[240, 260, 58, 22], "move":False},
            {"rect":[355, 330, 58, 22], "move":True,"mr":45,"msp":1.6},
            {"rect":[470, 250, 58, 22], "move":False},
            {"rect":[585, 170, 58, 22], "move":True,"mr":40,"msp":1.7},
            {"rect":[700, 90, 60, 22], "move":False},
        ],
        "spikes": [
            [98, 418, 36, 22],
            [150, 318, 36, 22],
            [270, 238, 36, 22],
            [385, 308, 36, 22],
            [500, 228, 36, 22],
            [615, 148, 36, 22],
        ],
        "monsters": [
            {"type":"patrol","x":250,"y":218,"range":38,"speed":2.4},
            {"type":"patrol","x":590,"y":128,"range":35,"speed":2.5},
        ],
        "chase_monsters":[
            {"x":360,"y":288,"speed":2.0,"detect_range":250},
            {"x":475,"y":208,"speed":1.9,"detect_range":230}
        ],
        "finish": [705, 46, 48, 44],
        "start_x": 15,
        "start_y": 350
    },
    # 第4关
    {
        "platforms": [
            {"rect":[0, 440, 85, 60], "move":False},
            {"rect":[105, 350, 54, 22], "move":True,"mr":48,"msp":1.6},
            {"rect":[210, 270, 54, 22], "move":False},
            {"rect":[315, 190, 54, 22], "move":True,"mr":44,"msp":1.7},
            {"rect":[420, 270, 54, 22], "move":False},
            {"rect":[525, 190, 54, 22], "move":True,"mr":40,"msp":1.8},
            {"rect":[630, 110, 58, 22], "move":False},
            {"rect":[720, 60, 55, 22], "move":True,"mr":35,"msp":1.9},
        ],
        "spikes": [
            [80, 418, 36, 22],
            [130, 328, 36, 22],
            [240, 248, 36, 22],
            [345, 168, 36, 22],
            [450, 248, 36, 22],
            [555, 168, 36, 22],
            [660, 88, 36, 22],
        ],
        "monsters": [
            {"type":"patrol","x":215,"y":228,"range":35,"speed":2.5},
            {"type":"patrol","x":425,"y":228,"range":33,"speed":2.6},
            {"type":"patrol","x":635,"y":68,"range":30,"speed":2.6},
        ],
        "chase_monsters":[
            {"x":320,"y":148,"speed":2.1,"detect_range":260},
            {"x":530,"y":148,"speed":2.0,"detect_range":240}
        ],
        "finish": [725, 16, 48, 44],
        "start_x": 12,
        "start_y": 350
    },
回复

使用道具 举报

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

本版积分规则

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