旅游网站开发 目的及必要性/网盘资源大全

旅游网站开发 目的及必要性,网盘资源大全,做网站维护累吗,个性婚纱摄影说明:我计划用angular做一款打地鼠的小游戏, 打地鼠游戏实现文档 🎮 游戏逻辑 ​游戏场景 采用 3x3 网格布局的 9 个地鼠洞​核心机制 地鼠随机从洞口弹出点击有效目标获得积分30 秒倒计时游戏模式 ​难度系统 简单模式:生成间…

说明:我计划用angular做一款打地鼠的小游戏,

打地鼠游戏实现文档

🎮 游戏逻辑

  • 游戏场景
    采用 3x3 网格布局的 9 个地鼠洞
  • 核心机制
    • 地鼠随机从洞口弹出
    • 点击有效目标获得积分
    • 30 秒倒计时游戏模式
  • 难度系统
    • 简单模式:生成间隔 1.5s / 停留 1s
    • 普通模式:生成间隔 1s / 停留 0.8s
    • 困难模式:生成间隔 0.8s / 停留 0.6s

⚙️ 主要功能

  • 游戏控制
    • 开始/结束游戏按钮
    • 游戏进行中禁止重复启动
  • 状态显示
    • 实时分数更新
    • 动态倒计时显示
  • 交互系统
    • 可视化难度选择按钮
    • 点击命中即时反馈
  • 动画效果
    • 地鼠弹出/收回动画
    • 按钮激活状态指示

🔧 实现细节

效果图

在这里插入图片描述

技术实现

step1:C:\Users\wangrusheng\WebstormProjects\untitled4\src\app\mouse\mouse.component.ts

import { Component } from '@angular/core';
import {NgForOf, NgIf, TitleCasePipe} from '@angular/common';@Component({selector: 'app-mouse',imports: [NgForOf,NgIf,TitleCasePipe],templateUrl: './mouse.component.html',styleUrl: './mouse.component.css'
})
export class MouseComponent {score = 0;timeLeft = 30;isPlaying = false;holes = Array(9).fill(false);private gameTimer: any;private moleTimer: any;// 新增类型安全难度列表readonly difficultyLevels = ['easy', 'medium', 'hard'] as const;difficulty: 'easy' | 'medium' | 'hard' = 'medium';// 根据难度调整参数get intervalTime() {return {easy: 1500,medium: 1000,hard: 800}[this.difficulty];}get activeTime() {return {easy: 1000,medium: 800,hard: 600}[this.difficulty];}startGame() {if (this.isPlaying) return;this.isPlaying = true;this.score = 0;this.timeLeft = 30;// 游戏倒计时this.gameTimer = setInterval(() => {this.timeLeft--;if (this.timeLeft <= 0) {this.endGame();}}, 1000);// 地鼠生成this.moleTimer = setInterval(() => {this.popUpMole();}, this.intervalTime);}endGame() {clearInterval(this.gameTimer);clearInterval(this.moleTimer);this.isPlaying = false;this.holes = this.holes.map(() => false);}popUpMole() {if (!this.isPlaying) return;const index = Math.floor(Math.random() * 9);this.holes[index] = true;setTimeout(() => {this.holes[index] = false;}, this.activeTime);}whackMole(index: number) {if (this.holes[index] && this.isPlaying) {this.score += 10;this.holes[index] = false;}}setDifficulty(level: 'easy' | 'medium' | 'hard') {this.difficulty = level;}
}

step2:
C:\Users\wangrusheng\WebstormProjects\untitled4\src\app\mouse\mouse.component.html

<!-- mouse.component.html -->
<div class="game-card"><div class="game-container"><div class="game-info"><div class="info-group"><div class="info-item"><span class="label">Score:</span><span class="value">{{ score }}</span></div><div class="info-item"><span class="label">Time:</span><span class="value">{{ timeLeft }}</span></div></div><div class="difficulty-group"><span class="label">Difficulty:</span><div class="button-group"><button*ngFor="let diff of difficultyLevels"[class.active]="difficulty === diff"(click)="setDifficulty(diff)"class="difficulty-btn">{{ diff | titlecase }}</button></div></div><buttonclass="start-btn"(click)="startGame()"[disabled]="isPlaying">{{ isPlaying ? 'Playing...' : 'Start Game' }}</button></div><div class="game-board"><div*ngFor="let hole of holes; let i = index"class="hole"[class.active]="hole"(click)="whackMole(i)"><div class="mole" *ngIf="hole"></div></div></div></div>
</div>

step3:
C:\Users\wangrusheng\WebstormProjects\untitled4\src\app\mouse\mouse.component.css

/* mouse.component.css */
.game-card {background: #ffffff;border-radius: 16px;box-shadow: 0 10px 30px rgba(0,0,0,0.1);padding: 24px;max-width: 800px;margin: 2rem auto;transition: transform 0.3s ease;
}.game-card:hover {transform: translateY(-2px);
}.game-container {text-align: center;
}.game-info {margin-bottom: 32px;display: flex;flex-direction: column;gap: 24px;
}.info-group {display: flex;justify-content: center;gap: 32px;margin-bottom: 16px;
}.info-item {background: #f8f9fa;padding: 12px 24px;border-radius: 8px;box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}.label {font-weight: 600;color: #6c757d;margin-right: 8px;
}.value {font-weight: 700;color: #495057;
}.difficulty-group {display: flex;flex-direction: column;gap: 12px;align-items: center;
}.button-group {display: flex;gap: 12px;
}button {border: none;border-radius: 8px;padding: 10px 20px;font-weight: 600;cursor: pointer;transition: all 0.2s ease;text-transform: uppercase;letter-spacing: 0.5px;
}.difficulty-btn {background: #e9ecef;color: #495057;min-width: 90px;
}.difficulty-btn.active {background: #4e66f8;color: white;box-shadow: 0 4px 6px rgba(78,102,248,0.2);
}.start-btn {background: #20c997;color: white;padding: 14px 32px;font-size: 1.1rem;margin-top: 16px;
}.start-btn:disabled {background: #ced4da;box-shadow: none;
}.start-btn:not(:disabled):hover {background: #1aa179;box-shadow: 0 4px 14px rgba(26,161,121,0.3);
}.game-board {display: grid;grid-template-columns: repeat(3, 1fr);gap: 20px;max-width: 600px;margin: 0 auto;padding: 20px;background: #f8f9fa;border-radius: 12px;
}.hole {width: 150px;height: 150px;background: #654321;border-radius: 50%;position: relative;overflow: hidden;cursor: pointer;transition: transform 0.2s, background 0.3s;
}.hole:hover {transform: scale(1.02);
}.hole.active {background: #8b4513;box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}.mole {position: absolute;width: 80%;height: 80%;background: #808080;border-radius: 50%;bottom: -30%;left: 10%;transition: bottom 0.3s;animation: pop-up 0.3s forwards;
}@keyframes pop-up {from { bottom: -30%; }to { bottom: 10%; }
}

end

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

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

相关文章

博客网站(springboot)整合deepseek实现在线调用

&#x1f389;&#x1f389;&#x1f389;&#x1f389;&#x1f389;&#x1f389; 欢迎访问的个人博客&#xff1a;https://swzbk.site/&#xff0c;加好友&#xff0c;拉你入福利群 &#x1f389;&#x1f389;&#x1f389;&#x1f389;&#x1f389;&#x1f389; 1、de…

Kubernetes 单节点集群搭建

Kubernetes 单节点集群搭建教程 本人尝试基于Ubuntu搭建一个单节点K8S集群&#xff0c;其中遇到各种问题&#xff0c;最大的问题就是网络&#xff0c;各种镜像源下载不下来&#xff0c;特此记录&#xff01;注意&#xff1a;文中使用了几个镜像&#xff0c;将看来可能失效导致安…

专题三0~n-1中缺失的数字

1.题目 给一个数组&#xff0c;单调性是递增的&#xff0c;需要找到缺失的数字&#xff0c;加上这个数字就变为等差数组了。 2.算法原理 这里用二分来解决&#xff0c;而二段性是根据下标区分&#xff0c;临界值前的数字于下标相对应&#xff0c;临界值后的于下标相差1&#x…

【图像处理】ISP(Image Signal Processor) 图像处理器的用途和工作原理?

ISP&#xff08;图像信号处理器&#xff09;是数字影像设备的“视觉大脑”&#xff0c;负责将传感器捕获的原始电信号转化为我们看到的高清图像。以下从用途和工作原理两方面通俗解析&#xff1a; 一、ISP的核心用途&#xff1a;让照片“更像眼睛看到的” 提升画质&#xff1a…

python学习笔记-mysql数据库操作

现有一个需求&#xff0c;调用高德api获取全国县级以上行政区数据并保存为json文件&#xff0c;使用python获取&#xff1a; import requests import json# 高德API Key api_key "your_api_key"# 调用行政区域查询API def fetch_districts():url f"https://r…

Redisson 实现分布式锁源码浅析

大家好&#xff0c;我是此林。 今天来分享Redisson分布式锁源码。还是一样&#xff0c;我们用 问题驱动 的方式展开讲述。 1. redis 中如何使用 lua 脚本&#xff1f; Redis内置了lua解释器&#xff0c;lua脚本有两个好处&#xff1a; 1. 减少多次Redis命令的网络传输开销。…

【软件】免费的PDF全文翻译软件,能保留公式图表的样式

转载请注明出处&#xff1a;小锋学长生活大爆炸[xfxuezhagn.cn] 如果本文帮助到了你&#xff0c;欢迎[点赞、收藏、关注]哦~ 很多PDF全文翻译软件都是收费的&#xff0c;而划线翻译看着又很累。这个开源的PDF全文翻译软件非常好用&#xff0c;并且能够保留公式、图表、目录和注…

PentestGPT 下载

PentestGPT 下载 PentestGPT 介绍 PentestGPT&#xff08;Penetration Testing GPT&#xff09;是一个基于大语言模型&#xff08;LLM&#xff09;的智能渗透测试助手。它结合了 ChatGPT&#xff08;或其他 GPT 模型&#xff09;与渗透测试工具&#xff0c;帮助安全研究人员自…

防火墙虚拟系统实验

一实验拓扑 二实验过程 配置资源 创建虚拟系统 配置管理员 创建安全策略

Linux与深入HTTP序列化和反序列化

深入HTTP序列化和反序列化 本篇介绍 在上一节已经完成了客户端和服务端基本的HTTP通信&#xff0c;但是前面的传递并没有完全体现出HTTP的序列化和反序列化&#xff0c;为了更好得理解其工作流程&#xff0c;在本节会以更加具体的方式分析到HTTP序列化和反序列化 本节会在介绍…

基于Python+SQLite实现(Web)验室设备管理系统

实验室设备管理系统 应用背景 为方便实验室进行设备管理&#xff0c;某大学拟开发实验室设备管理系统 来管理所有实验室里的各种设备。系统可实现管理员登录&#xff0c;查看现有的所有设备&#xff0c; 增加设备等功能。 开发环境 Mac OSPyCharm IDEPython3Flask&#xff…

深拷贝and浅拷贝!

一、什么是拷贝&#xff1f;什么是深拷贝和浅拷贝&#xff1f; &#xff08;1&#xff09;拷贝&#xff1a;拷贝就是为了复用原对象的部分or全部数据&#xff0c;在原对象的基础上通过复制的方式创建一个新的对象。 拷贝对象可以分为三种类型&#xff1a;直接赋值、浅拷贝和深拷…

高频面试题(含笔试高频算法整理)基本总结回顾43

干货分享&#xff0c;感谢您的阅读&#xff01; &#xff08;暂存篇---后续会删除&#xff0c;完整版和持续更新见高频面试题基本总结回顾&#xff08;含笔试高频算法整理&#xff09;&#xff09; 备注&#xff1a;引用请标注出处&#xff0c;同时存在的问题请在相关博客留言…

网络爬虫【简介】

我叫补三补四&#xff0c;很高兴见到大家&#xff0c;欢迎一起学习交流和进步 今天来讲一讲视图 一、网络爬虫的定义 网络爬虫&#xff08;Web Crawler&#xff09;&#xff0c;又称为网络蜘蛛、网络机器人等&#xff0c;是一种按照一定规则自动抓取互联网信息的程序或脚本。它…

​AI时代到来,对电商来说是效率跃升,还是温水煮青蛙

​凌晨三点的义乌商贸城&#xff0c;95后创业者小王&#xff0c;静静地盯着屏幕上的AI工具&#xff0c;竟露出了笑容。这个月他的跨境玩具店销量提升了不少&#xff0c;从之前的状态翻了3倍&#xff1b;而且团队人数有所变化&#xff0c;从5人缩减到了2人&#xff08;其中包括他…

PDF文件密码保护破解:安全解密的步骤与技巧

PDF文件加密后&#xff0c;需要特定的密码才能访问内容。以下是一些常见的方法来解密PDF文件&#xff1a; 方法一&#xff1a;使用Adobe Acrobat 如果你有Adobe Acrobat Pro&#xff0c;可以使用它来解密PDF文件。 打开Adobe Acrobat Pro&#xff1a; 启动Adobe Acrobat Pro…

qt 自带虚拟键盘的编译使用记录

一、windows 下编译 使用vs 命令窗口&#xff0c;分别执行&#xff1a; qmake CONFIG"lang-en_GB lang-zh_CN" nmake nmake install 如果事先没有 指定需要使用的输入法语言就进行过编译&#xff0c;则需要先 执行 nmake distclean 清理后执行 qmake 才能生效。 …

C++刷题(二):栈 + 队列

&#x1f4dd;前言说明&#xff1a; 本专栏主要记录本人的基础算法学习以及刷题记录&#xff0c;使用语言为C。 每道题我会给出LeetCode上的题号&#xff08;如果有题号&#xff09;&#xff0c;题目&#xff0c;以及最后通过的代码。没有题号的题目大多来自牛客网。对于题目的…

精通游戏测试笔记(持续更新)

第一章、游戏测试的两条规则 不要恐慌 不要将这次发布当作最后一次发布 不要相信任何人 把每次发布当作最后一次发布 第二章&#xff1a;成为一名游戏测试工程师

Windows功能之FTP服务器搭建

一、创作背景 之前有用linux系统搭建过ftp服务器&#xff0c;最近想着用windows系统也顺便搭建一个&#xff0c;看网上有第三方服务软件一键部署&#xff0c;记得windows可以不借助第三方软件就可以搭建&#xff0c;就想顺便操作试试&#xff0c;结果老是连接不上&#xff0c;费…