quality of life
This commit is contained in:
+7
-5
@@ -38,6 +38,7 @@ end
|
||||
|
||||
-- The player can hold a button to collect those resources and store them on their ship.
|
||||
|
||||
local last_message = ""
|
||||
function love.update(dt)
|
||||
if love.keyboard.isDown("w") then
|
||||
player_ship.velocity_y = player_ship.velocity_y - player_ship.acceleration * dt
|
||||
@@ -66,17 +67,17 @@ function love.update(dt)
|
||||
end
|
||||
end
|
||||
if distance_to_point > selected_point.radar_size^2 then
|
||||
print("Too far to pick up cargo.")
|
||||
last_message = "Too far to pick up cargo."
|
||||
return
|
||||
end
|
||||
if player_ship.cargo_free_space <= 0 then
|
||||
print("No cargo space left.")
|
||||
last_message = "No cargo space left."
|
||||
return
|
||||
end
|
||||
local cargo_type = next(selected_point.cargo_contents)
|
||||
local cargo_amount = math.min(player_ship.cargo_fill_speed * dt, selected_point.cargo_contents[cargo_type])
|
||||
if cargo_amount <= 0 then
|
||||
print("There is no cargo to pick up.")
|
||||
last_message = "There is no cargo to pick up."
|
||||
return
|
||||
end
|
||||
if not player_ship.cargo_contents[cargo_type] then
|
||||
@@ -86,13 +87,14 @@ function love.update(dt)
|
||||
player_ship.cargo_free_space = player_ship.cargo_free_space - cargo_amount
|
||||
selected_point.cargo_contents[cargo_type] = selected_point.cargo_contents[cargo_type] - cargo_amount
|
||||
selected_point.cargo_free_space = selected_point.cargo_free_space + cargo_amount
|
||||
print("Transfered " .. cargo_amount .. " " .. cargo_type .. ".")
|
||||
last_message = "Transfered " .. cargo_amount .. " " .. cargo_type .. "."
|
||||
end
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
-- love.graphics.circle("fill", player_ship.position_x, player_ship.position_y, 5)
|
||||
love.graphics.print(last_message, 1, 1)
|
||||
|
||||
love.graphics.rectangle("line", player_ship.position_x - player_ship.radar_size / 2, player_ship.position_y - player_ship.radar_size / 2, player_ship.radar_size, player_ship.radar_size)
|
||||
|
||||
for i = 1, #resource_points do
|
||||
|
||||
Reference in New Issue
Block a user