python--城堡保卫战

news2024/11/23 9:58:49

实现功能:

1:敌人的绵绵不断的前进,拿着各种各样的武器(叉子,斧头,宝剑),挥动武器攻击我方城堡,对我方城堡造成伤害!

2:我方城堡发现敌人可手动点击鼠标左键来发起子弹攻击,对日人造成致命伤害,让其死亡!

3:完备的数据显示,攻击敌人获取金币,累计得分,当前管卡的级别,我方城堡生命值的显示等等,击杀敌人获取的金币可以兑换额外属性来装备回复加强我方堡垒!

4:项目的布局界面优美干净,结合添加的纯音乐游戏背景和攻击音效以及实时的动画显示(如我方城堡的外观会随着我方城堡生命值的降低而发生改变,也就是变得会破败一些等等)以此让项目更加具有可玩性!

5:拿该项目练手或者作为一个python简单的课程设计也是一个可以的选择!

6:项目总代码700行左右

用到的编程知识:

python基础,os文件读写,pygame模块以及面向对象思想!

代码如下:

enemy.py类文件(100行代码左右)

import pygame

class Enemy(pygame.sprite.Sprite):
   def __init__(self, health, animation_list, x, y, speed):
      pygame.sprite.Sprite.__init__(self)
      self.alive = True
      self.speed = speed
      self.health = health
      self.last_attack = pygame.time.get_ticks()
      self.attack_cooldown = 1000
      self.animation_list = animation_list
      self.frame_index = 0
      self.action = 0#0: walk, 1: attack, 2: death
      self.update_time = pygame.time.get_ticks()

      #select starting image
      self.image = self.animation_list[self.action][self.frame_index]
      self.rect = pygame.Rect(0, 0, 25, 40)
      self.rect.center = (x, y)


   def update(self, surface, target, bullet_group):
      if self.alive:
         #check for collision with bullets
         if pygame.sprite.spritecollide(self, bullet_group, True):
            #lower enemy health
            self.health -= 25

         #check if enemy has reached the castle
         if self.rect.right > target.rect.left:
            self.update_action(1)

         #move enemy
         if self.action == 0:
            #update rectangle position
            self.rect.x += self.speed

         #attack
         if self.action == 1:
            #check if enough time has passed since last attack
            if pygame.time.get_ticks() - self.last_attack > self.attack_cooldown:
               target.health -= 25
               if target.health < 0:
                  target.health = 0
               self.last_attack = pygame.time.get_ticks()


         #check if health has dropped to zero
         if self.health <= 0:
            target.money += 100
            target.score += 100
            self.update_action(2)#death
            self.alive = False

      self.update_animation()

      #draw image on screen
      surface.blit(self.image, (self.rect.x - 10, self.rect.y - 15))


   def update_animation(self):
      #define animation cooldown
      ANIMATION_COOLDOWN = 50
      #update image depending on current action
      self.image = self.animation_list[self.action][self.frame_index]
      #check if enough time has passed since the last update
      if pygame.time.get_ticks() - self.update_time > ANIMATION_COOLDOWN:
         self.update_time = pygame.time.get_ticks()
         self.frame_index += 1
      #if the animation has run out then reset back to the start
      if self.frame_index >= len(self.animation_list[self.action]):
         if self.action == 2:
            self.frame_index = len(self.animation_list[self.action]) - 1
         else:
            self.frame_index = 0


   def update_action(self, new_action):
      #check if the new action is different to the previous one
      if new_action != self.action:
         self.action = new_action
         #update the animation settings
         self.frame_index = 0
         self.update_date = pygame.time.get_ticks()

castle.py类文件(500行代码左右)

# 导入库
import pygame
import math
import os
import sys
import random
import button
from pygame import mixer
# 初始化pygame
pygame.init()

# 定义游戏窗口高度和宽度
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
# 加载背景音乐
pygame.mixer.music.load("sound/bjmusic.WAV")
pygame.mixer.music.set_volume(0.3)
jump_fx = pygame.mixer.Sound("sound/bullet.wav")
jump_fx.set_volume(0.5)

# 创建游戏窗口
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("城堡防卫战")

clock = pygame.time.Clock()
FPS = 60

# 定义游戏变量
level = 1
high_score = 0
level_difficulty = 0
target_difficulty = 1000
DIFFICULTY_MULTIPLIER = 1.1
game_over = False
next_level = False
ENEMY_TIMER = 1000
last_enemy = pygame.time.get_ticks()
enemies_alive = 0
max_towers = 4
TOWER_COST = 5000
# 定义炮塔位置的列表
tower_positions = [
[SCREEN_WIDTH - 250, SCREEN_HEIGHT - 200],
[SCREEN_WIDTH - 200, SCREEN_HEIGHT - 150],
[SCREEN_WIDTH - 150, SCREEN_HEIGHT - 150],
[SCREEN_WIDTH - 100, SCREEN_HEIGHT - 150]
]

# 加载最高分
if os.path.exists('socre.txt'):
    with open('socre.txt', 'r') as file:
        high_score = int(file.read())

# 定义颜色
WHITE = (255, 255, 255)
GREY = (100, 100, 100)

# 定义字体
font = pygame.font.SysFont('华文彩云', 30)
font_60 = pygame.font.SysFont('华文行楷', 60)

# 加载图片
bg = pygame.image.load('img/bg.png').convert_alpha()
# 城堡
castle_img_100 = pygame.image.load('img/castle/castle_100.png').convert_alpha()
castle_img_50 = pygame.image.load('img/castle/castle_50.png').convert_alpha()
castle_img_25 = pygame.image.load('img/castle/castle_25.png').convert_alpha()

# 炮塔
tower_img_100 = pygame.image.load('img/tower/tower_100.png').convert_alpha()
tower_img_50 = pygame.image.load('img/tower/tower_50.png').convert_alpha()
tower_img_25 = pygame.image.load('img/tower/tower_25.png').convert_alpha()

# 子弹图像
bullet_img = pygame.image.load('img/bullet.png').convert_alpha()
b_w = bullet_img.get_width()
b_h = bullet_img.get_height()
bullet_img = pygame.transform.scale(bullet_img, (int(b_w * 0.075), int(b_h * 0.075)))

# 创建敌人类
class Enemy(pygame.sprite.Sprite):
    def __init__(self, health, animation_list, x, y, speed):
        super().__init__()
        self.alive = True
        self.speed = speed
        self.health = health
        self.last_attack = pygame.time.get_ticks()
        self.attack_cooldown = 1000
        self.animation_list = animation_list
        self.frame_index = 0
        self.action = 0
        self.update_time = pygame.time.get_ticks()
        # 选择动画开始的图片
        self.image = self.animation_list[self.action][self.frame_index]
        self.rect = pygame.Rect(0, 0, 25, 40)
        self.rect.center = (x, y)

    def update(self, surface, target, bullet_group):
        if self.alive:
            # 检查敌人与子弹的碰撞
            if pygame.sprite.spritecollide(self, bullet_group, True):
                # 减少健康
                self.health -= 25
            # 检查敌人是否已经到达城堡
            if self.rect.right > target.rect.left:
                self.update_action(1)
            # 移动敌人
            if self.action == 0:
                self.rect.x += 1
            # 攻击城堡
            if self.action == 1:
                # 检测冷却时间
                if pygame.time.get_ticks() - self.last_attack > self.attack_cooldown:
                    target.health -= 25
                    if target.health < 0:
                        target.health = 0
                    self.last_attack = pygame.time.get_ticks()
            # 检查敌人血条是否为0
            if self.health <= 0:
                target.money += 100
                target.score += 100
                self.update_action(2)
                self.alive = False
        # 调用更新动画
        self.update_animation()
        # 绘制敌人
        # pygame.draw.rect(surface, (255, 255, 255), self.rect, 1)
        surface.blit(self.image, (self.rect.x - 10, self.rect.y - 15))

    def update_animation(self):
        # 定义动画冷却时间
        ANIMATION_COOLDOWN = 50
        # 根据选择的冬瓜更新帧
        self.image = self.animation_list[self.action][self.frame_index]
        # 判断多久更新一次帧
        if pygame.time.get_ticks() - self.update_time > ANIMATION_COOLDOWN:
            self.update_time = pygame.time.get_ticks()
            self.frame_index += 1
        # 检查帧数不能超过最大帧数
        if self.frame_index >= len(self.animation_list[self.action]):
            if self.action == 2:
                self.frame_index = len(self.animation_list[self.action]) - 1
            else:
                self.frame_index = 0
    def update_action(self, new_action):
        # 检查新动作与上一个动作是否相同
        if new_action != self.action:
            self.action = new_action
            # 更新动画重置
            self.frame_index = 0
            self.update_time = pygame.time.get_ticks()


# 加载敌人列表
enemy_animations = []
enemy_tpyes = ['knight', 'goblin', 'purple_goblin', 'red_goblin']
enemy_health = [75, 100, 125, 150]

animation_types = ['walk', 'attack', 'death']
for enemy in enemy_tpyes:
    # 加载动画列表
    animation_list = []
    for animation in animation_types:
        # 创建临时列表
        temp_list = []
        # 定义帧数
        num_of_frames = 20
        for i in range(num_of_frames):
            img = pygame.image.load(f'img/enemies/{enemy}/{animation}/{i}.png').convert_alpha()
            e_w = img.get_width()
            e_h = img.get_height()
            img = pygame.transform.scale(img, (int(e_w * 0.2), int(e_h * 0.2)))
            temp_list.append(img)
        animation_list.append(temp_list)
    enemy_animations.append(animation_list)

#  加载按钮图片
repair_img = pygame.image.load('img/repair.png').convert_alpha()
armour_img = pygame.image.load('img/armour.png').convert_alpha()

# 在屏幕上输出文本信息
def draw_text(text, font, text_color, x, y):
    img = font.render(text, True, text_color)
    screen.blit(img, (x, y))

# 定义一个显示状态的函数
def show_info():
    draw_text('钱数:' + str(castle.money), font, GREY, 10, 10)
    draw_text('分数:' + str(castle.score), font, GREY, 180, 10)
    draw_text('最分数:' + str(high_score), font, GREY, 180, 50)
    draw_text('级别:' + str(level), font, GREY, SCREEN_WIDTH // 2, 10)
    draw_text('健康:' + str(castle.health) + "/" + str(castle.max_health), font, GREY, SCREEN_WIDTH - 230, SCREEN_HEIGHT - 50)
    draw_text('1000', font, GREY, SCREEN_WIDTH - 250, 70)
    draw_text(str(TOWER_COST), font, GREY, SCREEN_WIDTH - 150, 70)
    draw_text('500', font, GREY, SCREEN_WIDTH - 70, 70)

# 城堡类
class Castle():
    def __init__(self, image100, image50, image25,  x, y, scale):
        self.health = 1000
        self.max_health = self.health
        self.fired = False
        self.money = 0
        self.score = 0
        width = image100.get_width()
        height = image100.get_height()

        self.image100 = pygame.transform.scale(image100, (int(width * scale), int(height * scale)))
        self.image50 = pygame.transform.scale(image50, (int(width * scale), int(height * scale)))
        self.image25 = pygame.transform.scale(image25, (int(width * scale), int(height * scale)))
        self.rect = self.image100.get_rect()
        self.rect.x = x
        self.rect.y = y

    def shoot(self):
        pos = pygame.mouse.get_pos()
        x_dist = pos[0] - self.rect.midleft[0]
        y_dist = -(pos[1] - self.rect.midleft[1])
        self.angle = math.degrees(math.atan2(y_dist, x_dist))
        # 在该位置点击鼠标
        if pygame.mouse.get_pressed()[0] and self.fired == False and pos[1] > 70:
            self.fired = True
            bullet = Bullet(bullet_img, self.rect.midleft[0], self.rect.midleft[1], self.angle)
            bullet_group.add(bullet)
            jump_fx.play()
        # 重置鼠标点击
        if pygame.mouse.get_pressed()[0] == False:
            self.fired = False

    def draw(self):
        # 根据血量判断加载那张图片
        if self.health <= 250:
            self.image = self.image25
        elif self.health <= 500:
            self.image = self.image50
        else:
            self.image = self.image100
        screen.blit(self.image, self.rect)

    def repair(self):
        if self.money >= 1000 and self.health < self.max_health:
            self.health += 500
            self.money -= 1000
            if castle.health > castle.max_health:
                castle.health = castle.max_health
    def armour(self):
        if self.money >= 500:
            self.max_health += 250
            self.money -= 500

# 炮塔类
class Tower(pygame.sprite.Sprite):
    def __init__(self, image100, image50, image25, x, y, scale):
        super().__init__()
        self.got_target = False
        self.angle = 0
        self.last_shot = pygame.time.get_ticks()
        width = image100.get_width()
        height = image100.get_height()

        self.image100 = pygame.transform.scale(image100, (int(width * scale), int(height * scale)))
        self.image50 = pygame.transform.scale(image50, (int(width * scale), int(height * scale)))
        self.image25 = pygame.transform.scale(image25, (int(width * scale), int(height * scale)))
        self.image = self.image100
        self.rect = self.image100.get_rect()
        self.rect.x = x
        self.rect.y = y
    def update(self, enemy_group):
        self.got_target = False
        for e in enemy_group:
            if e.alive:
                target_x, target_y = e.rect.midbottom
                self.got_target = True
                break
        if self.got_target:
            x_dist = target_x - self.rect.midleft[0]
            y_dist = -(target_y - self.rect.midleft[1])
            self.angle = math.degrees(math.atan2(y_dist, x_dist))
            # pygame.draw.line(screen, WHITE, (self.rect.midleft[0], self.rect.midleft[1]), (target_x, target_y))
            shot_cooldown = 1000
            # 开火
            if pygame.time.get_ticks() - self.last_shot > shot_cooldown:
                self.last_shot = pygame.time.get_ticks()
                bullet = Bullet(bullet_img, self.rect.midleft[0], self.rect.midleft[1], self.angle)
                bullet_group.add(bullet)
        # 根据城堡血量判断加载那张图片
        if castle.health <= 250:
            self.image = self.image25
        elif castle.health <= 500:
            self.image = self.image50
        else:
            self.image = self.image100

# 创建子弹类
class Bullet(pygame.sprite.Sprite):
    def __init__(self, image, x, y, angle):
        super().__init__()
        self.image = image
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.angle = math.radians(angle) # 角度转换为弧度
        self.speed = 10
        # 根据角度计算水平和垂直的速度
        self.dx = math.cos(self.angle) * self.speed
        self.dy = -(math.sin(self.angle) * self.speed)

    def update(self):
        # 检测子弹是否已经超出窗口
        if self.rect.right < 0 or self.rect.left > SCREEN_WIDTH or self.rect.bottom < 0 or self.rect.top > SCREEN_HEIGHT:
            self.kill()
        # 移动子弹
        self.rect.x += self.dx
        self.rect.y += self.dy

# 创建十字准心
class Crosshair():
    def __init__(self, scale):
        image = pygame.image.load("img/crosshair.png").convert_alpha()
        width = image.get_width()
        height = image.get_height()
        self.image = pygame.transform.scale(image, (int(width * scale), int(height * scale)))
        self.rect = self.image.get_rect()
        # 隐藏鼠标指针
        pygame.mouse.set_visible(False)

    def draw(self):
        mx, my = pygame.mouse.get_pos()
        self.rect.center = (mx, my)
        screen.blit(self.image, self.rect)

# 创建城堡
castle = Castle(castle_img_100, castle_img_50, castle_img_25,  SCREEN_WIDTH - 250, SCREEN_HEIGHT - 300, 0.2)

# 实例化十字准心
crosshair = Crosshair(0.025)

# 创建按钮
repair_button = button.Button(SCREEN_WIDTH - 240, 10, repair_img, 0.5)
tower_button = button.Button(SCREEN_WIDTH - 130, 10, tower_img_100, 0.1)
armour_button = button.Button(SCREEN_WIDTH - 75, 10, armour_img, 1.5)

# 创建组
bullet_group = pygame.sprite.Group()
enemy_group = pygame.sprite.Group()
tower_group = pygame.sprite.Group()

# 穿件临时塔
# tower = Tower(tower_img_100, tower_img_50, tower_img_25, SCREEN_WIDTH - 350, SCREEN_HEIGHT - 200, 0.2)
# tower_group.add(tower)

# 游戏循环显示窗口
pygame.mixer.music.unpause()
pygame.mixer.music.play(-1)
run = True
while run:

    clock.tick(FPS)

    if game_over == False:

        screen.blit(bg, (0, 0))
        # 显示城堡
        castle.draw()
        castle.shoot()

        # 显示炮塔
        tower_group.draw(screen)
        tower_group.update(enemy_group)

        # 显示十字准心
        crosshair.draw()

        # 绘制子弹到屏幕
        bullet_group.update()
        bullet_group.draw(screen)

        # 绘制敌人
        enemy_group.update(screen, castle, bullet_group)

        # 显示详细信息
        show_info()

        # 显示按钮 修理和铠甲按钮
        if repair_button.draw(screen):
            castle.repair()
        if tower_button.draw(screen):
            # 检查是否有足够的金钱来建造炮塔
            if castle.money >= TOWER_COST and len(tower_group) < max_towers:
                tower = Tower(tower_img_100,
                              tower_img_50,
                              tower_img_25,
                              tower_positions[len(tower_group)][0],
                              tower_positions[len(tower_group)][1],
                              0.2)
                tower_group.add(tower)
                # 减去消耗的金钱数
                castle.money -= TOWER_COST

        if armour_button.draw(screen):
            castle.armour()

        # 创建不同的敌人
        if level_difficulty < target_difficulty:
            if pygame.time.get_ticks() - last_enemy > ENEMY_TIMER:
                # 创建敌人实例
                e = random.randint(0, len(enemy_tpyes) - 1)
                enemy = Enemy(enemy_health[e], enemy_animations[e], -100, SCREEN_HEIGHT - 100, 1)
                enemy_group.add(enemy)
                last_enemy = pygame.time.get_ticks()
                level_difficulty += enemy_health[e]
        # 检测是所有的的敌人都产生了
        if level_difficulty >= target_difficulty:
            # 检查有多少敌人仍然是活着的
            enemies_alive = 0
            for e in enemy_group:
                if e.alive == True:
                    enemies_alive += 1
            # 检测如果活着的敌人都被消灭了则当前级别就完成了
            if enemies_alive == 0 and next_level == False:
                next_level = True
                level_reset_time = pygame.time.get_ticks()
        # 判断是否进入下一关
        if next_level == True:
            draw_text('关卡已完成', font_60, WHITE, 200, 300)
            # 更新最高分
            if castle.score > high_score:
                high_score = castle.score
                with open('socre.txt', 'w') as file:
                    file.write(str(high_score))
            if pygame.time.get_ticks() - level_reset_time > 1500:
                next_level = False
                level += 1
                last_enemy = pygame.time.get_ticks()
                target_difficulty *= DIFFICULTY_MULTIPLIER
                level_difficulty = 0
                enemy_group.empty()
        # 检查游戏是否结束
        if castle.health <= 0:
            game_over = True

    else:
        draw_text('游戏结束!', font, GREY, 300, 300)
        draw_text('按下"A"重新进入游戏', font, GREY, 250, 350)
        pygame.mouse.set_visible(True)
        key = pygame.key.get_pressed()
        if key[pygame.K_a]:
            # 重置游戏
            game_over = False
            level = 1
            target_difficulty = 1000
            level_difficulty = 0
            last_enemy = pygame.time.get_ticks()
            enemy_group.empty()
            tower_group.empty()
            castle.score = 0
            castle.health = 1000
            castle.max_health = castle.health
            castle.money = 0
            pygame.mouse.set_visible(False)



    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
            pygame.quit()
            sys.exit()
    pygame.display.update()

button.py类文件(50行代码左右)

import pygame

# 按钮类
class Button():
   def __init__(self, x, y, image, scale):
      width = image.get_width()
      height = image.get_height()
      self.image = pygame.transform.scale(image, (int(width * scale), int(height * scale)))
      self.rect = self.image.get_rect()
      self.rect.topleft = (x, y)
      self.clicked = False

   def draw(self, surface):
      action = False
      # 得到鼠标的位置
      pos = pygame.mouse.get_pos()

      # 检测鼠标指针的碰撞
      if self.rect.collidepoint(pos):
         if pygame.mouse.get_pressed()[0] == 1 and self.clicked == False:
            self.clicked = True
            action = True

      if pygame.mouse.get_pressed()[0] == 0:
         self.clicked = False

      # 画按钮到屏幕上
      surface.blit(self.image, (self.rect.x, self.rect.y))

      return action

部分运行截图:

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/158396.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux-文件系统

Windows文件系统 在Windows下&#xff0c;打开“计算机”&#xff0c;我们看到的是一个个驱动盘符。 注意&#xff1a;盘符与硬件不是对应的&#xff0c;比如说电脑有有一块硬盘&#xff0c;到Windows下可以将其切成C、D、E盘&#xff0c;也就是一个硬盘可以放多个盘符。 Lin…

maple-example简单操作示例

好久都没写博客了&#xff0c;今天学习到一点新知识&#xff0c;在这里小编和大家分享&#xff0c;欢迎大家指点&#xff0c;这篇文章是关于 maple-example的简单操作示例&#xff0c;具体软件下载不做讲解&#xff0c;谢谢&#xff01;

浅谈分辨率带宽RBW

频谱仪是射频工程师最常用的设备之一&#xff0c;信号的频率、功率、谐波、相位噪声等诸多射频参数都需要使用频谱仪测试。使用频谱仪时&#xff0c;有一个参数需要经常设置&#xff0c;就是分辨率带宽(Resolution BW&#xff0c;简称RBW)。RBW是指中频链路上最小的中频滤波器带…

Enhance the Visual Representation via Discrete Adversarial Training

在自然语言处理NLP中&#xff0c;AT可以从泛化中受益&#xff0c;我们注意到AT在NLP任务中的有优点可能来自于离散和符号输入空间。为了借鉴NLP风格AT的优势&#xff0c;我们提出了离散对抗训练&#xff08;DAT&#xff09;。DAT利用VQGAN将图像数据改为离散的类似文本的输入&a…

Vuex的学习内容

本教程使用的是vue3 1.核心概念 官网地址:https://vuex.vuejs.org/安装(固定)配置项(固定) 2. 图示关系 单一定义store对象,里面5个配置项,在任意组件可以使用. 3.案例准备 准备两个组件AddItem.vue、SubItem.vue、Main.vue 展示效果如下: AddItem代码 <template&…

STL - String容器

1. string基本概念 本质&#xff1a; string是C风格的字符串&#xff0c;而string本质上是一个类 string和char *的区别&#xff1a; char *是一个指针 string是一个类&#xff0c;类内部封装了char *,管理这个字符串&#xff0c;是一个char *型的容…

本地小说阅读网站打造

目录 一、本地小说网站总体组织框架 1、所需的VUE库和elementLib以及JQ库 2、本地目录设计 3、整体代码样式 二、正文核心代码 1、引入element 样式&#xff0c;和自定义的样式 2、引入JS 3、自定义Header组件 1&#xff09;vue 定义MyHeader组件 2&#xff09;MyHead…

Mapstruct的具体介绍与使用

我是 ABin-阿斌&#xff1a;写一生代码&#xff0c;创一世佳话&#xff0c;筑一览芳华。 如果小伙伴们觉得我的文章不错&#xff0c;记得一键三连哦 文章目录一、mapstruct简介二、mapstruct与其他映射对比三、mapstruct底层原理解析1、Java动态编译四、具体使用1、依赖导入2、…

Linux开发工具的使用(三)

文章目录Linux开发工具的使用&#xff08;三&#xff09;1. 缓冲区1.1 理解\r和\n1.2 缓冲区的初步理解1.3 倒计时小程序实现1.4 进度条小程序实现2. 分布式版本控制系统-git使用2.1 git历史2.2 git版本控制理解2.3 git使用2.3.1 gitee搭建远程仓库2.3.2 开始配置3. Linux调试器…

Revit教程:创建“幕墙竖梃族”的方法步骤

幕墙竖梃族分为两个组成部分&#xff1a;“幕墙竖梃”和“公制轮廓-竖梃”&#xff0c;前者是基于后者轮廓的一个实体拉伸&#xff0c;两者的关系类似于实体与草图。轮廓族及门窗族 (公制门-幕墙&#xff0c;公制窗-幕墙而非公制门与公制窗)可以嵌套入CAD详图或Revit详图&#…

93、【树与二叉树】leetcode ——222. 完全二叉树的节点个数:普通二叉树求法+完全二叉树性质求法(C++版本)

题目描述 原题链接&#xff1a;222. 完全二叉树的节点个数 解题思路 1、普通二叉树节点个数求法 &#xff08;1&#xff09;迭代&#xff1a;层序遍历BFS 遍历一层获取一层结点 /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode …

【九】Netty HTTP+XML协议栈开发

HTTP协议介绍业务场景流程图技术栈设计流程图的分析:Step 1Step2Step3Step4Step5分析结果开发开发流程图代码jar 依赖代码结构如图pojo 包request包response 包client 包server包编码解码基类代码说明测试服务端打印结果客户端打印结果总结介绍 由于HTTP协议的通用性&#xff…

使用js实现一个可以【放烟花】的小游戏

放烟花游戏需求&#x1f447;核心玩法&#x1f447;&#x1f447;界面原型&#x1f447;&#x1f447;成品演示&#x1f447;游戏开发1.游戏素材准备2.代码实现1.创建index.html页面2.首页-开始3.加载烟花音效4.重玩儿放烟花的小游戏。点击页面放烟花。兼容移动端。 游戏需求 …

作为普通网民,这些“实用电脑神器”,值得你知道

国内软件夹缝里求生存&#xff0c;由于某些不良软件&#xff0c;许多人对于国产软件认识多为“流氓、捆绑、多广告”&#xff0c;其实并非如此&#xff0c;下面几款让你刮目相看&#xff0c;扭转观念。 1、图片视频画质增强器 这是一款功能极其强大的图片与视频画质增强器&…

阿里云数据湖3.0解决方案两度登上InfoQ 2022年度榜单

经过一个多月的层层竞选&#xff0c;【阿里云数据湖 3.0 解决方案】从 130 多个方案中脱颖而出&#xff0c;荣获 InfoQ 2022 年度中国技术力量年度榜单《十大云原生创新技术方案》&《云原生十大场景化落地方案》双料大奖&#xff0c;这是头部技术媒体对阿里云存储的再一次认…

低代码是什么?有什么优势?一文看懂LowCode

低代码到底是什么&#xff1f;用最简单的方式告诉我&#xff1f;低代码是近两年来一个很热门的概念&#xff0c;尤其是疫情的影响&#xff0c;市场对低代码的需求不断增加&#xff0c;但到底什么是低代码&#xff1f;它到底有什么好处&#xff1f;这篇就为大家解答这个问题&…

vue2.0 插槽不是响应性的

请注意插槽不是响应性的。如果你需要一个组件可以在被传入的数据发生变化时重渲染&#xff0c;我们建议改变策略&#xff0c;依赖诸如 props 或 data 等响应性实例选项。-- vm.$slots 问题描述 项目中自定了组件 widget&#xff0c;作为容器&#xff0c;其中 header 部分做了预…

SCI投稿:MDPI旗下期刊Mathematics投稿经历

最近写了篇论文&#xff0c;由于国内期刊现状&#xff08;懂的都懂&#xff09;&#xff0c;打算投国外的期刊&#xff0c;看来看去选择投MDPI旗下的Mathematics。手稿经过一轮大修之后顺利收到了Accepted&#xff0c;过程还是比较顺利的&#xff0c;记录一下投稿过程。 论文撰…

Matlab实现的FEMIC的说明书

FEMIC程序是用来反演小回路频域电磁感应数据的。要启动代码,在Matlab命令窗口中输入start,然后点击“Enter”或“返回”按钮。然后会出现FEMIC的主界面,见图1。 它由几个输入区域组成,这几个区分别实现了:加载数据,反演过程控制和最终显示。 图1 主界面 下面对这些输入…

[oeasy]python0045_四种进制_binary_octal_decimal_hexadecimal

四种进制 回忆上次内容 上次研究了 通过 八进制数值 转义 \ooo把(ooo)8进制对应的ascii字符输出 转义序列 \n、\t 是 转义序列\xhh 也是 转义序列\ooo 还是 转义序列 现在 总共有 几种进制 了呢&#xff1f;&#x1f914; 先数一下 树 数树 树 就是这么多棵树 用八进制的…