Skip to content

Commit

Permalink
骰子点数变化时加一个文本动画
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Jan 12, 2025
1 parent 42e0e3b commit a34178c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions assets/map/lue_first.luaon
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ local t=1/3
---@type ReroChess.MapData
return {
playerData={
{name='略1',skin="一只略",dicePoints={1,2},diceWeights={1,2}},
{name='略2',skin="铅笔略",startLocation='hospital',dicePoints={4,5,6}},
{name='略3',skin="长相潦草的幽灵",startLocation='jail',dicePoints={4,5,6}},
{name='略1',skin="一只略",dicePoints={1,2,3},diceWeights={1,2,3}},
-- {name='略2',skin="铅笔略",startLocation='hospital',dicePoints={4,5,6}},
-- {name='略3',skin="长相潦草的幽灵",startLocation='jail',dicePoints={4,5,6}},
},
decoData={
{'setCL',0,0,0},
Expand All @@ -18,12 +18,12 @@ return {
{'mDrawQ',TEX.world.default,QUAD.world.finish,8,10,0,-1/128,1/128},
},
mapData={
{0,0,prop='label,start text,起点'},{1,0},{1,0},{1,0,prop='move,-1'},{1,0,prop='exTurn'},{1,t},
{0,0,prop='label,start text,起点'},{1,0,prop='diceMod,+,1'},{1,0,prop='diceMod,+,1'},{1,0,prop='move,-1'},{1,0,prop='exTurn'},{1,t},
{0,1,prop='move,-3'},{-1,t},{-1,0,prop='move,-2'},{-1,0,prop='move,-1'},{-1,0},{-1,t,prop='diceMod,+,1'},
{0,1,prop='exTurn,-1'},{1,t,prop='move,1'},{1,0},{1,0,prop='move,-1'},{1,0,prop='diceMod,*,2'},{1,t},
{0,1,prop='move,-1'},{-1,t,prop='move,-1'},{-1,0,prop='move,-1'},{-1,0},{-1,0,prop='diceMod,-,3'},{-1,t,prop='move,-3'},
{0,1},{1,t,prop='move,+1'},{1,0},{1,0,prop='text,@p+1'},{1,0,prop='text,HospitalExit'},{1,t,prop='move,-4'},
{0,1},{-1,t,prop='diceMod,/,2'},{-1,0,prop='diceMod,*,3'},{-1,0,prop='diceMod,^,2'},{-1,0,prop='diceMod,&,2'},{-1,t},
{0,1},{-1,t,prop='diceMod,/,2'},{-1,0,prop='diceMod,*,3'},{-1,0,prop='diceMod,^,2'},{-1,0,prop='diceMod,^,0.5'},{-1,t},
{0,1},{1,t,prop='move,-2'},{1,0,prop='teleport,hospital text,住院'},{1,0,prop='move,-1'},{1,0,prop='exTurn,-3'},{1,0,prop='text,JailExit'},{1,0},{1,-h,prop='exTurn'},
{0,-1,prop='text,@pSwap'},{0,-1},{0,-1,prop='move,-1'},{0,-1,prop='move,-18'},{0,-1,prop='text,@pQuitJail'},{0,-1,prop='text,@pHosp@sJail'},{0,-1,prop='text,@c-1'},{0,-1,prop='move,2'},{0,-1},
{1,-h,prop='move,-12'},{1,0,prop='text,前方\n苦痛之路'},{1,0,prop='move,-1'},{1,0,prop='move,-1'},{1,0,prop='move,-1'},
Expand Down
8 changes: 6 additions & 2 deletions assets/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ function Player:roll()
d.value=d.value/mod[2]
elseif mod[1]=='^' then
d.value=d.value^mod[2]
elseif mod[1]=='&' then
d.value=d.value^(1/mod[2])
end
self:popText{
text=mod[1]..mod[2],
duration=1,
x=self.dice.x-self.x,
y=self.dice.y-self.y+0.2,
}
d.value=math.floor(d.value+.001)
end
d.animState='bounce'
Expand Down
3 changes: 1 addition & 2 deletions assets/prop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ local modifiers={
['*']=true,
['/']=true,
['^']=true,
['&']=true,
}
Prop.diceMod={
parse=function(prop)
Expand All @@ -152,7 +151,7 @@ Prop.diceMod={
---@param P ReroChess.Player
code=function(P,op,num)
P:popText{
text=("下一次点数%s%d"):format(op,num),
text=("下次点数%s%d"):format(op,num),
duration=2,
}
table.insert(P.diceMod,{op,num})
Expand Down

0 comments on commit a34178c

Please sign in to comment.