Skip to content

Commit

Permalink
last fixes and button glyphs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRoboZ committed Mar 26, 2022
1 parent 2c39c8e commit bfcf667
Show file tree
Hide file tree
Showing 11 changed files with 589 additions and 617 deletions.
Binary file modified Art/pwr.aseprite
Binary file not shown.
Binary file modified Art/pwr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion debug.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Debug.lua ---------------------------------------

--Current stats - Tokens:7957 Chars:49248 Compressed:15305
--Current stats - Tokens:8003 Chars:49882 Compressed:15605

local DEBUG_PRINT = {}
local DEBUG_PRINT_I = 1
Expand Down
69 changes: 30 additions & 39 deletions menus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ end

function RenderFlag( x,y,lvl )
-- flattened x,y pairs (top left of sprite)
FLAGDEF=split"118, 69, 118, 62, 118, 76, 118, 83, 118, 97, 118, 90, 118, 104, 118, 111"
sspr( FLAGDEF[lvl*2-1],FLAGDEF[lvl*2], 10, 7, x, y )

FLAGDEF=split"79, 72, 86, 93, 107, 100, 114, 121"
sspr( 118,FLAGDEF[lvl], 10, 7, x, y )
end

function RenderTextOutlined( str, x, y, ocol, incol )
Expand Down Expand Up @@ -64,13 +63,13 @@ end

-- Campaign
function UpdateMenu_Campaign()
if btnp(0) then -- left
if btnp(⬅️) then
SetLevel( max(Level-1,1) )
elseif btnp(1) then -- right
elseif btnp(➡️) then
SetLevel( min(Level+1,#LEVELDEF) )
elseif btnp(4) and CountProfileTokens() >= MenuLvlTokenReq[Level] then -- btn1
elseif btnp(🅾️) and CountProfileTokens() >= MenuLvlTokenReq[Level] then
InitRace()
elseif btn(5) then -- btn 2
elseif btn() then
OpenMenu(1)
end
end
Expand All @@ -80,10 +79,11 @@ function RenderMenu_BG( y, h )
rect( 12, y-1, 116, h+1, 1 )

-- logo
sspr( 43, 114, 75, 14, 27, 5 )
sspr(unpack(split"33, 57, 56, 14, 27, 5"))
sspr(unpack(split"89, 61, 19, 10, 83, 9"))

-- car
pd_draw(1,38,88)
pd_draw(0,38,88)
end

function RenderMenu_Campaign()
Expand All @@ -98,7 +98,7 @@ function RenderMenu_Campaign()
-- position
ProfStnd=ReadProfile(Level,1)
rectfill( 16, 41, 46, 64, 1 )
sspr( 103, 40, 8, 9, 27, 43 ) -- trophy
sspr(unpack(split"65, 49, 8, 8, 27, 43")) -- trophy
col=7
if ProfStnd == 1 then
BestParticles( 27, 43 )
Expand All @@ -112,10 +112,9 @@ function RenderMenu_Campaign()
print( tostr(ProfStnd)..tostr( GetStandingSuffix(ProfStnd) ), 26, 57, col )
end

-- tokens
ProfTkns=ReadProfile(Level,2)
rectfill( 49, 41, 79, 64, 2 )
sspr( 23, 40, 7, 7, 61, 44 ) -- token
sspr(unpack(split"17, 121, 7, 7, 61, 44")) -- token
col=7
if ProfTkns == 20 then
BestParticles( 61, 43 )
Expand All @@ -124,18 +123,17 @@ function RenderMenu_Campaign()
end
print( tostr(ProfTkns).."/20", 56, 57, col )

-- time
rectfill( 82, 41, 112, 64, 3 )
sspr( 112, 41, 7, 7, 94, 44 ) -- clock
sspr(unpack(split"73, 50, 7, 7, 94, 44")) -- clock
PrintTime( ReadProfile(Level,3), 84, 57 )

print( " \142 race", 38, 70, 6 )
else
sspr( 39, 75, 8, 11, 30, 44 ) -- lock
sspr( 39, 75, 8, 11, 91, 44 ) -- lock
sspr(unpack(split"120, 34, 8, 11, 30, 44")) -- lock
sspr(unpack(split"120, 34, 8, 11, 91, 44")) -- lock
print( "race locked", 43, 48, 9 )

sspr( 23, 40, 7, 7, 36, 61 ) -- token
sspr(unpack(split"17, 121, 7, 7, 36, 61")) -- token
print( tostr(TotalTkns).."/".. tostr(MenuLvlTokenReq[Level]) .. " tokens", 46, 62, 6 )
end
print( "\139\145 country", 38, 77, 6 )
Expand All @@ -144,10 +142,10 @@ function RenderMenu_Campaign()
-- arrows
xoff=sin(time())*1.2
if Level < #LEVELDEF then
sspr( 113, 62, 5, 9, 120+xoff, 49 ) -- arrow
sspr( 113, 80, 5, 7, 120+xoff, 49 ) -- arrow
end
if Level > 1 then
sspr( 113, 62, 5, 9, 5-xoff, 49, 5, 9 ,1 ) -- arrow
sspr( 113, 80, 5, 7, 5-xoff, 49, 5, 7 ,1 ) -- arrow
end

end
Expand All @@ -160,32 +158,25 @@ function RenderMenu_Custom()
xoff=(flr(time()*3 )%2)
ypos=32 + CustomOption * 8
rectfill( 68, ypos-1, 104, ypos+5, 1 )
sspr( 115, 70, 3, 5, 64-xoff, ypos, 3, 5, 1 )
sspr( 115, 70, 3, 5, 106+xoff, ypos )
sspr( 113, 75, 3, 5, 64-xoff, ypos, 3, 5, 1 )
sspr( 113, 75, 3, 5, 106+xoff, ypos )

-- Level/Theme
print( "country", 29, 40, 6 )
print( LEVELDEF[CustomLevel][6], 65, 40, 7 )

-- Hills
print( "hills", 37, 48, 6 )
print( CUSTOM_SETSTR[CustomHills], 69, 48, 7 )

-- Curves
print( "curves", 33, 56, 6 )
print( CUSTOM_SETSTR[CustomCurves], 69, 56, 7 )

-- Seed
print( "seed", 41, 64, 6 )
print( CustomSeed, 69, 64, 7 )

print( " \142 race", 44, 76, 6 )
print( " \151 back", 44, 83, 6 )
end

function UpdateMenu_Custom()
if btnp(0) or btnp(1) then -- left/right
if btnp(0) then dir=-1 else dir=1 end
if btnp(⬅️) or btnp(➡️) then -- left/right
if btnp(➡️) then dir=-1 else dir=1 end
if CustomOption==1 then
CustomLevel=max(min(CustomLevel+dir,#LEVELDEF),1)
TotalTkns=CountProfileTokens()
Expand All @@ -200,13 +191,13 @@ function UpdateMenu_Custom()
else --if CustomOption==4 then
CustomSeed=max(min(CustomSeed+dir,100),1)
end
elseif btn(5) then -- btn 2
elseif btnp(❎) then
OpenMenu(1)
elseif btnp(2) then -- up
elseif btnp(⬆️) then
CustomOption=max( CustomOption-1, 1 )
elseif btnp(3) then -- down
elseif btnp(⬇️) then
CustomOption=min( CustomOption+1, 4 )
elseif btnp(4) then -- btn 1
elseif btnp(🅾️) then
IsCustomRace=1
InitRace()
end
Expand All @@ -218,22 +209,22 @@ function RenderMenu_Title()
ypos=31 + TitleOption * 10
rectfill( 30, ypos-2, 96, ypos+6, 1 )

sspr( 111, 76, 7, 7, 35, 40 )
sspr(unpack(split"24, 121, 7, 7, 35, 40")) --globe
print( "world tour", 48, 41, 7 )

sspr( 111, 83, 7, 7, 35, 50 )
sspr(unpack(split"33, 49, 7, 7, 35, 50")) --gear
print( "custom race", 48, 51, 7 )

RenderTextOutlined( "a game by pak-9", 35, 70, 0,6 )
RenderTextOutlined( "thx theroboz", 40, 80, 0,6 )
end

function UpdateMenu_Title()
if btnp(2) then -- up
if btnp(⬆️) then
TitleOption=1
elseif btnp(3) then -- down
elseif btnp(⬇️) then
TitleOption=2
elseif btnp(4) then -- btn 1
elseif btnp(🅾️) then
OpenMenu(TitleOption+1)
end
end
Expand Down
52 changes: 25 additions & 27 deletions particle.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
------------------ Particle.lua

-- particle definitions
-- 1.sx, 2.sy, 3.sw, 4.sh, 5.life 6.dx 7.dy 8.dsc 9. sc
-- sx sy sw sh lif dx dy dsc sc
PDEF=split([[
67, 24, 5, 5, 0.5, -0.5,0.25, -0.05, 1 /
67, 24, 5, 5, 0.5, 0.5, 0.25, -0.05, 1 /
16, 40, 7, 7, 0.2, 0.15, 0.25, -0.02, 1.2 /
72, 24, 4, 4, 1, 0.6, -0.5, -0.025, 1 /
68, 30, 4, 4, 1, -0.6,-0.5, -0.025, 1 /
72, 28, 3, 3, 0.2, -2, -2, -0.005, 0.4 /
66, 33, 4, 4, 0.2, 2, -0.5, -0.005, 0.5 /
72, 32, 4, 4, 0.3, 0.25,-0.5, -0.02, 0.8 /
67, 24, 5, 5, 4, 0.25,-0.5, 0.1, 0.2 /
98, 25, 5, 5, 0.8, 0, -0.01, -0.05, 1 /
98, 25, 5, 5, 0.8, 0, -0.01, -0.05, 1 /
27, 99, 5, 5, 0.5, -0.5,0.25, -0.05, 1 /
27, 99, 5, 5, 0.5, 0.5, 0.25, -0.05, 1 /
83, 23, 7, 7, 0.2, 0.15, 0.25, -0.02, 1.2 /
86, 48, 4, 4, 1, 0.6, -0.5, -0.025, 1 /
85, 53, 4, 4, 1, -0.6,-0.5, -0.025, 1 /
80, 48, 3, 3, 0.2, -2, -2, -0.005, 0.4 /
113,71, 4, 4, 0.2, 2, -0.5, -0.005, 0.5 /
83, 48, 4, 4, 0.3, 0.25,-0.5, -0.02, 0.8 /
27, 99, 5, 5, 4, 0.25,-0.5, 0.1, 0.2 /
80, 52, 5, 5, 0.8, 0, -0.01, -0.05, 1 /
80, 52, 5, 5, 0.8, 0, -0.01, -0.05, 1 /
]],"/")

sPartic, sParticT, sParticSc, sParticX, sParticY, NextPartic = {},{},{},{},{},1
Expand Down Expand Up @@ -44,15 +42,15 @@ end

function UpdateParticles()

npart=0
--npart=0
for i=1, #sPartic do
p = sPartic[i]
local p = sPartic[i]
if p != 0 then
npart = npart + 1
--npart += 1
srand(p)
sParticSc[i] += ( PDEF[p][8] + (rnd(0.5)) * PDEF[p][8] )
sParticX[i] += ( PDEF[p][6] + (rnd(0.5)) * PDEF[p][6] )
sParticY[i] += ( PDEF[p][7] + (rnd(0.5)) * PDEF[p][7] )
sParticSc[i] += ( PDEF[p][8] + rnd(0.5) * PDEF[p][8] )
sParticX[i] += ( PDEF[p][6] + rnd(0.5) * PDEF[p][6] )
sParticY[i] += ( PDEF[p][7] + rnd(0.5) * PDEF[p][7] )
if sParticSc[i] <= 0 or time() - sParticT[i] > PDEF[p][5] then
sPartic[i] = 0
end
Expand All @@ -62,11 +60,11 @@ end

function RenderParticles()
for i=1, #sPartic do
p = sPartic[i]
if p != 0 then
ssc=sParticSc[i]*10*PDEF[p][9]
rrect= { sParticX[i] - ssc * 0.5, sParticY[i] - ssc * 0.5, ssc, ssc }
sspr( PDEF[p][1], PDEF[p][2], PDEF[p][3], PDEF[p][4], rrect[1], rrect[2], rrect[3], rrect[4] )
end
end
end
local p = sPartic[i]
if p != 0 then
local ssc=sParticSc[i]*10*PDEF[p][9]
local rrect= { sParticX[i] - ssc * 0.5, sParticY[i] - ssc * 0.5, ssc, ssc }
sspr( PDEF[p][1], PDEF[p][2], PDEF[p][3], PDEF[p][4], rrect[1], rrect[2], rrect[3], rrect[4] )
end
end
end
Loading

0 comments on commit bfcf667

Please sign in to comment.