当前位置: 首页 > article >正文

制作一款打飞机游戏58:子弹模式组合

今天我们将继续深入探讨子弹模式系统,并在我们的模式编辑器上做一些收尾工作。

子弹模式系统的乐趣

首先,我想说,这个子弹模式系统真的非常有趣。看着屏幕上不断喷射的子弹,感觉真是太棒了!

合并修饰符

今天,我想添加一个合并修饰符。这个修饰符允许我们将多个子弹模式合并在一起,同时发射。这样,在BOSS战中,我们就可以一次性发射多种不同的子弹,而不是分别发射。我相信这将是一个非常有用的功能。

我将为这个合并修饰符创建一个菜单,并设置五个插槽来组合不同的子弹模式。如果将来需要更多插槽,我们可以随时增加。

实现合并修饰符

现在,让我们来实现这个合并修饰符。我们将遍历所有插槽,如果插槽中的值不为零,就生成对应的子弹模式,并将所有子弹添加到返回数组中。这样,我们就可以在屏幕上看到合并后的子弹效果了。

角度指示器

接下来,我想添加一个角度指示器。当敌人发射子弹时,角度指示器将显示子弹的发射角度,以避免混淆。我们将使用一个简单的公式来计算角度,并绘制一条线来表示子弹的发射方向。

测试新功能

在将新功能添加到游戏中之前,我想先做一个测试运行。在上一期的Doggy Zone中,我给大家布置了一个任务,那就是复制Loki Striker在《Steel Surge》中展示的一个美丽子弹模式。现在,我想亲自尝试一下,看看我们的系统是否足够灵活,能够创造出这样的模式。

创建新子弹模式

通过不断尝试和调整参数,我成功创建了一个类似Loki Striker展示的子弹模式。这个模式由两个螺旋子弹模式叠加而成,每个螺旋由三个子弹组成,部分子弹速度较快,部分较慢。看起来非常酷炫!

pico-8 cartridge // http://www.pico-8.com
version 41
__lua__
-- todo
------------------
-- bring it into the game
-- bring it into brainedit-- shift?-- assumptions
------------------
-- bullets don't change direction
-- bullets don't change speedfunction _init()--- customize here ---#include shmup_pats.txtfile="shmup_pats.txt"arrname="pats"data=pats#include shmup_myspr.txt#include shmup_anilib.txt----------------------debug={}msg={}_drw=draw_pats_upd=update_patsmenuitem(1,"export",export)reload(0x0,0x0,0x2000,"cowshmup.p8")curx=1cury=1scrolly=0scrollx=0scroll=0pspr={x=64,y=110}enspr={x=64,y=64,bulq={}}buls={} poke(0x5f2d, 1)selpat=1fireang=-99
endfunction _draw()_drw()if #msg>0 thenbgprint(msg[1].txt,64-#msg[1].txt*2,80,14)msg[1].t-=1if msg[1].t<=0 thendeli(msg,1)end  end-- debug --cursor(4,4)color(8)for txt in all(debug) doprint(txt)end
endfunction _update60()dokeys()domouse()mscroll=stat(36)scroll+=0.2scroll=scroll%16_upd()
endfunction dokeys()if stat(30) thenkey=stat(31)if key=="p" thenpoke(0x5f30,1)endelsekey=nilendendfunction domouse()local oldmousex=mousexlocal oldmousey=mouseymousex=stat(32)mousey=stat(33)mousemove=falseif mousex!=oldmousex or oldmousey!=mousey thenmousemove=trueendif stat(34)==0 thenclkwait=falseendclkl=falseclkr=falseif not clkwait thenif stat(34)==1 thenclkl=trueclkwait=trueelseif stat(34)==2 thenclkr=trueclkwait=true  endendend
-->8
--drawfunction draw_pats()cls(13)if flr(scroll)%2==0 thenfillp(0b0000111100001111.1)elsefillp(0b1111000011110000.1)endfor i=0,7 doline(i*16,0,i*16,128,5)endfillp(▥)for i=-1,7 doline(0,i*16+scroll,128,i*16+scroll,5)endfillp()--enemyline(enspr.x-2,enspr.y-2,enspr.x+2,enspr.y+2,5)line(enspr.x-2,enspr.y+2,enspr.x+2,enspr.y-2,5)local myang=0if fireang==-99 thenmyang=atan2(pspr.y-enspr.y,pspr.x-enspr.x)endline(enspr.x+sin(myang)*8,enspr.y+cos(myang)*8,enspr.x+sin(myang)*12,enspr.y+cos(myang)*12,5)--playercirc(pspr.x,pspr.y,3,5)for s in all(buls) dodrawobj(s) enddrawmenu()bgprint(#buls,3,120,5)endfunction draw_table()cls(2)--spr(0,0,0,16,16)drawmemnu()
endfunction drawmenu()if menu thenfor i=1,#menu dofor j=1,#menu[i] dolocal mymnu=menu[i][j]local c=mymnu.c or 13if i==cury and j==curx thenc=7if _upd==upd_type thenc=0endendbgprint(mymnu.w,mymnu.x+scrollx,mymnu.y+scrolly,13)   bgprint(mymnu.txt,mymnu.x+scrollx,mymnu.y+scrolly,c) endendendif menui thenfor i=1,#menui dofor j=1,#menui[i] dolocal mymnui=menui[i][j]local c=mymnui.c or 13if i==cury and j==curx thenc=7if _upd==upd_type thenc=0endend bgprint(mymnui.w,mymnui.x,mymnui.y,13)   bgprint(mymnui.txt,mymnui.x,mymnui.y,c) endendendif _upd==upd_type thenlocal mymnu=menu[cury][curx]local txt_bef=sub(typetxt,1,typecur-1)local txt_cur=sub(typetxt,typecur,typecur)local txt_aft=sub(typetxt,typecur+1)txt_cur=txt_cur=="" and " " or txt_cur if (time()*2)%1<0.5 thentxt_cur="\^i"..txt_cur.."\^-i"endlocal txt=txt_bef..txt_cur..txt_aftbgprint(txt,mymnu.x+scrollx,mymnu.y+scrolly,7)end
end-->8
--updatefunction update_pats()if key=="1" thenif fireang==-99 thenfireang=0elsefireang=-99endendrefresh_pats()enspr.x=mousexenspr.y=mouseyif clkl and selpat<=#pats thenpatshoot(enspr,selpat,fireang)enddobulq(enspr)dobuls(buls)if btnp(⬆️) thencury-=1endif btnp(⬇️) thencury+=1endcury=mid(1,cury,#menu)if cury==1 thencurx=1if btnp(⬅️) thenselpat-=1endif btnp(➡️) thenselpat+=1endselpat=mid(1,selpat,#pats+1)elseif cury==2 thencurx=1elseif cury==#menu thencurx=1elsecurx=2endif btnp(❎) thenlocal mymnu=menu[cury][curx]if mymnu.cmd=="patedit" then_upd=upd_typetypetxt=tostr(mymnu.txt)typecur=#typetxt+1callback=enter_patreturnelseif mymnu.cmd=="newpat" thenadd(pats,newpat("base"))returnelseif mymnu.cmd=="delpat" thendeli(pats,selpat)add(msg,{txt="pat deleted!",t=120})endendendfunction update_table()refresh_table()if btnp(⬆️) thencury-=1endif btnp(⬇️) thencury+=1endcury=(cury-1)%#menu+1cury-=mscrollcury=mid(1,cury,#menu)if btnp(⬅️) thencurx-=1endif btnp(➡️) thencurx+=1endif cury<#menu thencurx=(curx-2)%(#menu[cury]-1)+2elsecurx=1endlocal mymnu=menu[cury][curx]if mymnu.y+scrolly>110 thenscrolly-=4endif mymnu.y+scrolly<10 thenscrolly+=4endscrolly=min(0,scrolly)if mymnu.x+scrollx>110 thenscrollx-=2endif mymnu.x+scrollx<20 thenscrollx+=2endscrollx=min(0,scrollx)if btnp(❎) thenlocal mymnu=menu[cury][curx]if mymnu.cmd=="edit" then_upd=upd_typetypetxt=tostr(mymnu.txt)typecur=#typetxt+1callback=enter_tableelseif mymnu.cmd=="newline" thenadd(data,{0})  elseif mymnu.cmd=="newcell" thenadd(data[mymnu.cmdy],0)endend
endfunction upd_type()if key thenif key=="\r" then-- enterpoke(0x5f30,1)callback()returnelseif key=="\b" then--backspaceif typecur>1 thenif typecur>#typetxt thentypetxt=sub(typetxt,1,#typetxt-1)elselocal txt_bef=sub(typetxt,1,typecur-2)local txt_aft=sub(typetxt,typecur)typetxt=txt_bef..txt_aftendtypecur-=1endelseif typecur>#typetxt thentypetxt..=keyelselocal txt_bef=sub(typetxt,1,typecur-1)local txt_aft=sub(typetxt,typecur)typetxt=txt_bef..key..txt_aftendtypecur+=1endendif btnp(⬅️) thentypecur-=1endif btnp(➡️) thentypecur+=1endtypecur=mid(1,typecur,#typetxt+1)
end
-->8
--toolsfunction bgprint(txt,x,y,c)print("\#0"..txt,x,y,c)
endfunction spacejam(n)local ret=""for i=1,n doret..=" "endreturn ret
endfunction split2d(s)local arr=split(s,"|",false)for k, v in pairs(arr) doarr[k] = split(v)endreturn arr
endfunction mysgn(v) return v==0 and 0 or sgn(v)
endfunction rndrange(low,high)return flr(rnd(high+1-low)+low)
endfunction mspr(si,sx,sy)local _x,_y,_w,_h,_ox,_oy,_fx,_nx=unpack(myspr[si])sspr(_x,_y,_w,_h,sx-_ox,sy-_oy,_w,_h,_fx==1)if _fx==2 thensspr(_x,_y,_w,_h,sx-_ox+_w,sy-_oy,_w,_h,true)endif _nx thenmspr(_nx,sx,sy)end
endfunction cyc(age,arr,anis)local anis=anis or 1return arr[(age\anis-1)%#arr+1]
endfunction drawobj(obj)mspr(cyc(obj.age,obj.ani,obj.anis),obj.x,obj.y)--★if coldebug and obj.col thenmsprc(obj.col,obj.x,obj.y)end
endfunction copylist(org)local ret={}for k, v in pairs(org) doret[k]=vendreturn ret
end
-->8
--i/o
function export()local s=arrname.."=split2d\""for i=1,#data doif i>1 thens..="|"endfor j=1,#data[i] doif j>1 thens..=","ends..=data[i][j]endends..="\""printh(s,file,true)add(msg,{txt="exported!",t=120})--debug[1]="exported!"
end
-->8
--uifunction refresh_pats()menu={}if selpat>#pats thenadd(menu,{{txt="< new pat ",w="          ",cmd="newpat",x=4,y=4,c=13  }})return endlocal mypat=pats[selpat]add(menu,{{txt="< pat "..selpat.." >",w="    ",cmd="pat",x=4,y=4,c=13  }})add(menu,{{txt=mypat[1],w="    ",cmd="patedit",cmdy=selpat,cmdx=1,x=4,y=12,c=13  }})local mycap={}if mypat[1]=="base" thenmycap={"spd :","ani :","anis:","col :" }elseif mypat[1]=="some" thenmycap={"src :","perc:"} elseif mypat[1]=="sprd" thenmycap={"src :","from:","to  :","ang :","spd :","time:","mirr:"}  elseif mypat[1]=="brst" thenmycap={"src :","num :","ang :","spd :","time:"}elseif mypat[1]=="comb" thenmycap={"src1:","src2:","src3:","src4:","src5:"} elsefor i=2,#mypat doadd(mycap,"p"..i..":")endendfor i=2,#mypat doadd(menu,{{txt=mycap[i-1],w="     ",cmd="",cmdy=selpat,cmdx=i,x=4,y=6+i*7,c=13  },{txt=mypat[i],w=spacejam(#tostr(mypat[i])),cmd="patedit",cmdy=selpat,cmdx=i,x=24,y=6+i*7,c=13  }}) endadd(menu,{{txt="delete",w="      ",cmd="delpat",cmdy=selpat,x=4,y=6+#mypat*7+9,c=13  }})endfunction refresh_table()menu={}for i=1,#data dolocal lne={}local linemax=#data[i]if i==cury thenlinemax+=1  endadd(lne,{txt=i,w="   ",cmd="",x=4,y=-4+8*i,c=2  })for j=1,linemax doif j==#data[i]+1 thenadd(lne,{txt="+",w=" ",cmd="newcell",cmdy=i,x=-10+14*(j+1),y=-4+8*i, })elseadd(lne,{txt=data[i][j],cmd="edit",cmdx=j,cmdy=i,x=-10+14*(j+1),y=-4+8*i,w="   "})endendadd(menu,lne)endadd(menu,{{txt=" + ",w="   ",cmd="newline",x=4,y=-4+8*(#data+1), }})
endfunction newpat(typ)if typ=="base" thenreturn {"base",1,11,3,40} elseif typ=="some" thenreturn {"some",1,0.5}elseif typ=="sprd" thenreturn {"sprd",1,1,1,0.1,0,0,0}elseif typ=="brst" thenreturn {"brst",1,1,0.5,0,5}elseif typ=="comb" thenreturn {"comb",1,0,0,0,0}elsereturn {typ} endendfunction enter_pat()local mymnu=menu[cury][curx]local typeval=typetxtif mymnu.cmdx==1 then--tricky!!if data[mymnu.cmdy][mymnu.cmdx]!=typetxt and typetxt!="" thendata[mymnu.cmdy]=newpat(typetxt)   endelsetypeval=tonum(typeval)if typeval==nil thentypeval=0enddata[mymnu.cmdy][mymnu.cmdx]=tonum(typeval)end_upd=update_pats
endfunction enter_table()local mymnu=menu[cury][curx]local typeval=typetxtif typeval==nil or typeval=="" thenif mymnu.cmdx==#data[mymnu.cmdy] and typetxt=="" then--delete celldeli(data[mymnu.cmdy],mymnu.cmdx)if mymnu.cmdx==1 thendeli(data,mymnu.cmdy)end_upd=update_tablereturnend  typeval=0end   data[mymnu.cmdy][mymnu.cmdx]=typeval_upd=update_table
end
-->8
--patsfunction dobuls(arr)for s in all(arr) dos.age+=1s.x+=s.sxs.y+=s.syif s.y<-16 or s.y>130 thendel(arr,s)endend
endfunction patshoot(en,pat,pang)if pang==-99 thenpang=atan2(pspr.y-en.y,pspr.x-en.x)endlocal mybuls=makepat(pat,pang)for b in all(mybuls) doadd(en.bulq,b)end
endfunction dobulq(en)for b in all(en.bulq) doif b.wait<=0 thenb.x+=en.xb.y+=en.yb.sx=sin(b.ang)*b.spdb.sy=cos(b.ang)*b.spdadd(buls,b)del(en.bulq,b)elseb.wait-=1endend
endfunction makepat(pat,pang)local mypat,ret=pats[pat],{}local patype,p2,p3,p4,p5,p6,p7,p8=unpack(mypat)if patype=="base" thenadd(ret,{age=0,x=0,y=0,ang=pang,spd=p2,ani=anilib[p3],anis=p4,col=p5,wait=0})elseif patype=="some" thenif rnd()<p3 thenret=makepat(p3,pang)endelseif patype=="sprd" thenfor i=p3-1,p4-1 dofor p in all(makepat(p2,pang)) dop.spd+=i*p6p.wait+=i*p7add(ret,p)if i>0 and p8>0 thenlocal copyp=copylist(p)copyp.ang+=i*-p5add(ret,copyp)endp.ang+=i*p5endendelseif patype=="brst" thenfor i=1,p3 dolocal rndw,rnds=flr(rnd(p6)),rnd(p5)for p in all(makepat(p2,pang+spread(p4))) dop.wait+=rndwp.spd+=rndsadd(ret,p)endendelseif patype=="comb" thenfor i=2,5 doif mypat[i]>0 thenfor p in all(makepat(mypat[i],pang)) doadd(ret,p)endendendendreturn ret
endfunction spread(val)return (rnd(2)-1)*val
end__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__map__
0000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

相关文章:

制作一款打飞机游戏58:子弹模式组合

今天我们将继续深入探讨子弹模式系统&#xff0c;并在我们的模式编辑器上做一些收尾工作。 子弹模式系统的乐趣 首先&#xff0c;我想说&#xff0c;这个子弹模式系统真的非常有趣。看着屏幕上不断喷射的子弹&#xff0c;感觉真是太棒了&#xff01; 合并修饰符 今天&#…...

使用新一代达梦管理工具SQLark,高效处理 JSON/XML 数据!

在应用开发领域&#xff0c;JSON/XML数据结构因其灵活性和通用性&#xff0c;成为开发者存储和交换数据的首选。然而&#xff0c;传统管理工具在处理这些半结构化数据时&#xff0c;往往存在可视化效果差、编辑效率低等问题&#xff0c;严重影响开发者的工作效率。 现在&#…...

Qt基础:数据容器类

数据容器类 1. QList1.1 使用创建和初始化添加和删除元素访问和修改元素查找和判断元素遍历列表排序和筛选与其他容器的转换 1.2 完整示例 1. QList 在Qt中&#xff0c;QList 是一个动态数组容器类&#xff0c;用于存储和管理相同类型的元素。它提供了快速随机访问、动态扩展和…...

Vue3监听对象数组属性变化方法

在Vue3中&#xff0c;监听对象数组中某个属性的变化可以通过以下几种方法实现&#xff1a; 方法一&#xff1a;深度监听整个数组并比较属性变化 使用 watch 函数并启用 deep: true&#xff0c;在回调中遍历比较新旧数组的特定属性。 javascript 复制 下载 import { ref, …...

深入了解PyTorch:起源、优势、发展与安装指南

深入了解PyTorch&#xff1a;起源、优势、发展与安装指南 目录 引言PyTorch简介PyTorch的优势 动态计算图直观易用的API强大的社区支持丰富的生态系统高性能与可扩展性 PyTorch的发展历程PyTorch的主要组件 Torch.TensorAutograd自动求导nn模块TorchvisionTorchText和TorchAu…...

DeepSeek智能对话助手项目

目录&#xff1a; 1、效果图2、实现代码3、温度和TopK的作用对比 1、效果图 2、实现代码 # import gradio as gr# def reverse_text(text): # return text[::-1]# demogr.Interface(fnreverse_text,inputs"text",outputs"text")# demo.launch(share&q…...

浅谈Mysql的MVCC机制(RC与RR隔离级别)

MVCC&#xff08;Multi-Version Concurrency Control&#xff09;多版本并发控制 说这个我们先来了解一下Mysql的隔离级别&#xff0c;因为MVCC和Mysql的隔离级别是有关的。 Mysql默认的隔离级别是RR&#xff08;可重复读&#xff09; 其他的隔离级别是读未提交&#xff08;…...

uniapp-商城-72-shop(5-商品列表,购物车实现回顾)

我们通过前面的章节已经将数据添加到了购物车,但实际上购物车的处理还有很多东西需要完成。 我们看看如何将商品添加到购物车。 本文介绍了购物车功能的实现方式,重点讲解了如何将商品添加到购物车以及购物车状态管理的处理机制。主要内容包括:1. 通过Vuex管理购物车状态,包…...

【git】 pull + rebase 或 pull + merge什么区别?

在Git中,pull + rebase 和 pull + merge 是两种整合远程分支更新的方式,其核心区别在于如何处理提交历史。以下是详细对比: 核心区别 操作提交历史结构合并方式冲突处理适用场景pull + merge保留分支分叉和合并节点创建新的合并提交(Merge Commit)一次性解决所有冲突公共…...

1. 编程语言进化史与JavaScript

引言 作为一名开发者,理解编程语言的演进历史和核心特性是至关重要的。接下来将从编程语言的三个历史阶段入手,重点解析JavaScript的起源、特性及其与相关技术的关系,同时补充进制转换的基础知识,为初学者构建完整的知识体系。 一、编程语言的三大历史阶段 1. 机器语言(…...

Vue3 中 Axios 深度整合指南:从基础到高级实践引言

在现代前端开发中&#xff0c;与后端API的交互是构建动态应用的核心环节。Axios作为最流行的HTTP客户端之一&#xff0c;以其简洁的API和强大的功能在前端生态中占据重要地位。本文将全面探讨如何在Vue3项目中高效整合Axios&#xff0c;从基础配置到高级封装&#xff0c;从性能…...

MySQL#Select语句执行过程

服务端程序架构 MySQL 是典型的 C/S 架构&#xff0c;即 Client/Server 架构&#xff0c;服务器端程序mysqld。 Select语句执行过程 连接层 客户端和服务器端建立连接&#xff0c;客户端发送 SQL 至服务器端 SQL层 SQL语句处理 查询缓存&#xff1a; 缓存命中该SQL执行结果直…...

hbuilder中h5转为小程序提交发布审核

【注意】 [HBuilder] 11:59:15.179 此应用 DCloud appid 为 __UNI__9F9CC77 &#xff0c;您不是这个应用的项目成员。1、联系这个应用的所有者&#xff0c;请求加入项目成员&#xff08;https://dev.dcloud.net.cn "成员管理"-"添加项目成员"&#xff09;…...

文档注释:删还是不删

问题&#xff1a;代码中存在大量的文档注释&#xff0c;占用大量篇幅&#xff0c;一次难以看完整个文件&#xff0c;于是诞生了一个想法&#xff1a;删除所有文档注释&#xff0c;于是问了下 DeepWiki 文档注释对tree - sitter有影响吗&#xff1f;文档注释对Roocode大模型理解…...

【数据结构】单链表练习

1.链表的中间节点 https://leetcode.cn/problems/middle-of-the-linked-list/description/ 用快慢指针来解决 /*** Definition for singly-linked list.* struct ListNode {* int val;* struct ListNode *next;* };*/ struct ListNode* middleNode(struct ListNode* he…...

JVM 性能优化终极指南:全版本兼容、参数公式与场景实战

一、引言 JVM 优化的核心难点在于版本兼容性与场景适配性。从 Java 8 到 Java 21&#xff0c;JVM 的内存模型、GC 策略和默认参数发生了巨大变化&#xff1b;从高并发 Web 到大数据批处理&#xff0c;不同业务场景对延迟、吞吐量的要求也截然不同。本文基于历史会话中用户关注…...

分布式爬虫监控架构设计

1. 监控架构核心组件 1.1 日志集中管理 设计目标&#xff1a;聚合所有节点的运行日志&#xff0c;支持实时查询与异常分析。 实现方式&#xff1a; 日志采集&#xff1a;各节点通过 logging 模块将日志发送至中央存储&#xff08;如Elasticsearch或Redis&#xff09;。 日志…...

MySQL的参数 innodb_force_recovery 详解

MySQL的参数 innodb_force_recovery 详解 innodb_force_recovery 是 InnoDB 存储引擎的一个重要参数&#xff0c;用于在数据库崩溃恢复时控制恢复行为的级别。这个参数主要在数据库无法正常启动时使用&#xff0c;可以帮助我们从损坏的数据库中恢复数据。 一 参数概述 参数名…...

学习vue3:跨组件通信(provide+inject)

目录 一&#xff0c;关于跨组件通信概述 二&#xff0c;跨组件传值 案例1(爷传孙&#xff09; 三&#xff0c;跨组件传函数 案例2(爷传孙&#xff09; 疑问&#xff1a;孙子传给爷爷是否可行呢&#xff1f; 一&#xff0c;关于跨组件通信概述 之前我们学习了父子组件的传…...

Alibaba Sentinel 入门教程:从理论到实战

文章目录 第一部分&#xff1a;理论篇1. Sentinel 简介2. Sentinel 核心原理2.1 资源与规则2.2 Sentinel 工作主流程2.3 核心类解析 3. Sentinel 功能支持与使用流程3.1 流量控制3.2 熔断降级3.3 系统自适应保护3.4 热点参数限流3.5 黑白名单控制3.6 使用流程 4. Sentinel 架构…...

2.3 TypeScript 非空断言操作符(后缀 !)详解

在 TypeScript 中&#xff0c;当你开启了严格的空值检查&#xff08;strictNullChecks&#xff09;后&#xff0c;变量如果可能是 null 或 undefined&#xff0c;就必须在使用前进行显式的判断。为了在某些场景下简化代码&#xff0c;TypeScript 提供了非空断言操作符&#xff…...

【菜狗work前端】小程序加if判断时不及时刷新 vs Web

零、前提&#xff1a; 实现input输入数字不大于10000&#xff08;需要配合typenumber&#xff0c;maxlength5&#xff0c;这里没写&#xff09; 一、探究代码&#xff1a; <input v-model"model1" input"changeModel1" placeholder"请输入拒收件…...

01 NLP的发展历程和挑战

1.人工智能行业介绍 ANI、AGI、ASI 以下是弱人工智能&#xff08;ANI&#xff09;、强人工智能&#xff08;AGI&#xff09;和超强人工智能&#xff08;ASI&#xff09;的对比表格&#xff1a; 类型定义当前状态弱人工智能&#xff08;ANI&#xff09;专注于特定任务&#x…...

TCP 三次握手:详解与原理

无图、长文警告&#xff01;&#xff01;&#xff01;&#xff01; 文章目录 一、引言二、TCP 三次握手的过程&#xff08;一&#xff09;第一次握手&#xff1a;SYN&#xff08;同步序列号&#xff09;&#xff08;二&#xff09;第二次握手&#xff1a;SYN-ACK&#xff08;同…...

LabVIEW累加器标签通道

主要展示了 Accumulator Tag 通道的使用&#xff0c;通过三个并行运行的循环模拟不同数值的多个随机序列&#xff0c;分别以不同频率向累加器写入数值&#xff0c;右侧循环每秒读取累加器值&#xff0c;同时可切换查看每秒内每次事件的平均值&#xff0c;用于演示多线程数据交互…...

在 Unity 中,Start 方法直接设置 RectTransform 的位置,时出现问题,与预计位置不匹配。

改动之前的源代码&#xff1a;发现组件的位置&#xff0c;与设计的位置不一样&#xff0c;但是如果把这段代码&#xff0c;交给一个按钮按下回调&#xff0c;就不会出现问题。 void Start(){//初始化Text 行//读取配置文件&#xff1b;StaticDataObj obj Resources.Load<St…...

永磁同步电机控制算法--IP调节器

一、基本原理 在电机控制领域&#xff0c;现今普遍使用的是比例-积分(PI)控制器。然而&#xff0c;PI控制器有一些缺点&#xff0c;可能会在某些应用中产生一些问题&#xff0c;例如:一个非常快的响应&#xff0c;也同时具有过大的超调量。虽然设计PI控制器时&#xff0c;可以…...

Ubuntu 25.04 锁屏不能远程连接的解决方案

最近安装了一个 Ubuntu 25.04&#xff0c;偶然发现可以通过 windows 自带的 rdp 远程工具进行连接&#xff0c;内心狂喜。此外&#xff0c;还支持启动 VNC 协议&#xff0c;也就是默认支持了 rdp 和 vnc 连接。 看了以下&#xff0c;ubuntu 在用户级别下创建了一个远程桌面服务…...

Java 自动装箱和拆箱还有包装类的缓存问题

自动装箱和拆箱就是将基本数据类型和包装类之间进行自动的互相转换。JDK1.5 后&#xff0c; Java 引入了自动装箱(autoboxing)/拆箱(unboxing)。 自动装箱&#xff1a; 基本类型的数据处于需要对象的环境中时&#xff0c;会自动转为“对象”。 我们以 Integer 为例&#xff1a;…...

java-jdk8新特性Stream流

一、Stream流 是专业用于对集合或者数组进行便捷操作的。 1.1 Stream流的创建 主要分为Collection&#xff08;List与Set&#xff09;、Map、数组三种创建方式&#xff1a; //1.Collection集合的创建List<String> names new ArrayList<>();Collections.addAll(…...