Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a method for storing and setting ship attributes #28

Merged
merged 18 commits into from
Feb 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolved Master branch merge conflicts
Renamed the following:
ship_ship_2              is now ship_2
ship_shuttle_no_boosters is now ship_shuttle_2
noPlanet.tmx             is now no_planets.tmx

All references are updated in the code.
  • Loading branch information
Jon-Cavaliere committed Feb 2, 2022
commit a6503079574d9996c01798e7020b09acfc0b7e6f
File renamed without changes
File renamed without changes
11 changes: 11 additions & 0 deletions entities/player.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
--local sounds = require 'services/sounds'
local shipList = require('ships/shipList')

-- Returns the ship's attribute table based on index (shipList.lua) - J.R.C 2/2/22
local function get_ship(index)
if index == nil then
index = 1 -- Defaults to Trevor's OG ship if none is found in the map props.
end
return shipList[index]
end

return function(props)
local ship_index = tonumber(props.ship_type)
local ship = get_ship(ship_index)
return {
body = {
mass = 1
119 changes: 0 additions & 119 deletions maps/noPlanet.tmx

This file was deleted.

114 changes: 108 additions & 6 deletions maps/no_planets.tmx

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions services/textures.lua
Original file line number Diff line number Diff line change
@@ -12,6 +12,15 @@ textures.load = function()
textures.star = i 'star.png'
textures.planet = i 'planet.png'
textures.speedboost = i 'speedboost.png'

-- Assorted spaceships by Jon
textures.ship_2 = i 'ship_2.png' -- Ship Index 2
textures.ship_ufo = i 'ship_ufo.png' -- Ship Index 3
textures.ship_shuttle = i 'ship_shuttle.png' -- Ship Index 4
textures.ship_shuttle_2 = i 'ship_shuttle_2.png' -- Ship Index 5
textures.ship_purple = i 'ship_purple.png' -- Ship Index 6
textures.ship_green = i 'ship_green.png' -- Ship Index 7
textures.ship_big = i 'ship_big.png' -- Ship Index 8
end

return textures
8 changes: 4 additions & 4 deletions ships/shipList.lua
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ return {
},
[2] = {
displayName = 'Ship Two', -- Index 2
filename = 'ship_spaceship_2',
filename = 'ship_2',
shape = {
points = {
0, -25,
@@ -47,7 +47,7 @@ return {
type = 'polygon'
},
spritesheet = {
image = 'ship_spaceship_2',
image = 'ship_2',
offset_x = 12.5,
scale_x = 2
}
@@ -92,7 +92,7 @@ return {
},
[5] = {
displayName = 'Shuttle', -- Index 5
filename = 'ship_shuttle_no_boosters',
filename = 'ship_shuttle_2',
shape = {
points = {
0, -32,
@@ -104,7 +104,7 @@ return {
type = 'polygon'
},
spritesheet = {
image = 'ship_shuttle_no_boosters',
image = 'ship_shuttle_2',
offset_x = 16,
scale_x = 2
}