Skip to content

Commit

Permalink
Small improvement to title screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicfreeston committed Jun 2, 2023
1 parent e092625 commit 3000e5e
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions mygame/app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def initialize texts
end

def setup
@offset = @texts.credits ? -20 : -100
@offset = -100
t = @texts.instruction

state.instruction_letters =
Expand Down Expand Up @@ -234,8 +234,30 @@ def tick
size_px: 32,
alignment_enum: 1,
vertical_alignment_enum: 1,
}.merge(text_color)]

}.merge(text_color),
]

outputs.sprites << [
{
x: grid.center.x,
y: grid.center.y + 80,
w: 128,
h: 128,
path: SPATHS.player.flat,
anchor_x: 1,
anchor_y: 1,
},
{
x: grid.center.x,
y: grid.center.y + 80,
w: 128,
h: 128,
path: SPATHS.goal,
anchor_x: 0,
anchor_y: 1,
},
] if @texts.credits

outputs.labels << @texts.credits.map.with_index(- @texts.credits.length.idiv(2)) do |text, i|
r1 = layout.rect row: 10, col: 12 + i * 8, w: 0, h: 0
r2 = layout.rect row: 11, col: 12 + i * 8, w: 0, h: 0
Expand Down Expand Up @@ -584,7 +606,7 @@ def sprite_for_platform p
end
end

def render target = outputs
def render
sky_start = state.goal.y - 2000

outputs.primitives << [
Expand Down

0 comments on commit 3000e5e

Please sign in to comment.