-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
403 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"tileset": "Blocks", | ||
"sheet_size": [512, 512], | ||
"tile_size": 32, | ||
"blocks": { | ||
"$default": { | ||
"shape": "Cube", | ||
"unwrap_mode": "Collapsed", | ||
"orientation": 0 | ||
}, | ||
"9": { | ||
"$name": "grass_plains", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[10, 2], [1, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]] | ||
}, | ||
"10": { | ||
"$name": "grass_forest", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[11, 2], [1, 2], [3, 2], [3, 2], [3, 2], [3, 2], [3, 2]] | ||
}, | ||
"11": { | ||
"$name": "grass_snowy", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[12, 2], [1, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2]] | ||
}, | ||
"16": { | ||
"$name": "log_oak", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[9, 3], [9, 3], [1, 3], [1, 3], [1, 3], [1, 3], [1, 3]] | ||
}, | ||
"17": { | ||
"$name": "log_redwood", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[10, 3], [10, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3]] | ||
}, | ||
"18": { | ||
"$name": "log_spruce", | ||
"unwrap_mode": "Custom", | ||
"mapping": [[11, 3], [11, 3], [3, 3], [3, 3], [3, 3], [3, 3], [3, 3]] | ||
} | ||
}, | ||
"$mapping_order": ["top", "bottom", "left", "right", "back", "front"] | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
- Player | ||
- PlayerContainer | ||
- PlayerModel | ||
- CameraPivot | ||
- Camera | ||
- GUI | ||
- F3 | ||
- Version | ||
- Coords | ||
- Crosshair | ||
- SavedText | ||
- Hotbar | ||
- SelectedBlock | ||
- BlockPlacer | ||
- PauseMenu | ||
- PauseTitle | ||
- ResumeButton | ||
- ResumeButtonText | ||
- SaveButton | ||
- SaveButtonText | ||
- QuitButton | ||
- QuitButtonText | ||
- SaveMenu | ||
- SaveTitle | ||
- World1Button | ||
- World1ButtonText | ||
- World2Button | ||
- World2ButtonText | ||
- World3Button | ||
- World3ButtonText | ||
- BackButton | ||
- BackButtonText | ||
- Map | ||
- BlockPreview | ||
- Sky | ||
- Exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- Scripts | ||
- Camera | ||
- Background | ||
- Version | ||
- Logo | ||
- LoadingBox | ||
- LoadingText | ||
- Buttons | ||
- Main | ||
- PlayButton | ||
- ExitButton | ||
- Play | ||
- LoadWorldButton | ||
- NewWorldButton | ||
- WorldSelect | ||
- World1Button | ||
- World2Button | ||
- World3Button | ||
- WorldType | ||
- NormalWorldButton | ||
- FlatWorldButton | ||
- BackButton |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
local currentMenu = 'pause' | ||
local buttons = {"resume", "save", "world1", "world2", "world3", "back", "quit"} | ||
local hovered = {} | ||
local pos = {} | ||
|
||
local savedText | ||
local savedTick = 0 | ||
|
||
function Behavior:Update() | ||
savedTick = savedTick + 1 | ||
|
||
local camera = CS.FindGameObject("Camera") | ||
local mousePos = CS.Input.GetMousePosition() | ||
local ray = camera:GetComponent("Camera"):CreateRay(mousePos) | ||
|
||
local pauseMenu = CS.FindGameObject("PauseMenu") | ||
local saveMenu = CS.FindGameObject("SaveMenu") | ||
|
||
if not savedText then savedText = CS.FindGameObject("SavedText"):GetComponent("TextRenderer") end | ||
|
||
local size = {large = Vector3:New(.9, .9, .9), regular = Vector3:New(.8, .8, .8)} | ||
|
||
-- Pause menu open/close | ||
if CS.Input.WasButtonJustPressed("Escape") then | ||
ingame = not ingame | ||
currentMenu = 'pause' | ||
end | ||
self.gameObject.transform:SetLocalPosition(Vector3:New(0, 0, ingame and .5 or -.5)) | ||
CS.FindGameObject("GUI").transform:SetLocalPosition(Vector3:New(0, 0, ingame and -.25 or .25)) | ||
|
||
-- Initialise buttons | ||
for _,name in ipairs(buttons) do | ||
buttons[name] = CS.FindGameObject(name:sub(1,1):upper() .. name:sub(2) .. "Button") | ||
if not pos[name] then pos[name] = buttons[name].transform:GetPosition() end | ||
hovered[name] = ray:IntersectsModelRenderer(buttons[name]:GetComponent("ModelRenderer")) ~= nil | ||
buttons[name].transform:SetLocalScale(hovered[name] and size.large or size.regular) | ||
end | ||
|
||
-- Button clicks | ||
if CS.Input.WasButtonJustPressed("LClick") then | ||
if currentMenu == 'pause' then | ||
if hovered.resume then ingame = true | ||
elseif hovered.save then currentMenu = 'save' | ||
elseif hovered.quit then CS.Exit() | ||
end | ||
elseif currentMenu == 'save' then | ||
if hovered.back then currentMenu = 'pause' | ||
elseif hovered.world1 then SaveWorld(1) | ||
elseif hovered.world2 then SaveWorld(2) | ||
elseif hovered.world3 then SaveWorld(3) | ||
end | ||
end | ||
end | ||
|
||
-- Switch menus | ||
local positions = {visible = Vector3:New(0, 0, -0.5), hidden = Vector3:New(0, 0, 0.5)} | ||
if not ingame then | ||
if currentMenu == 'pause' then | ||
pauseMenu.transform:SetLocalPosition(positions.visible) | ||
saveMenu.transform:SetLocalPosition(positions.hidden) | ||
elseif currentMenu == 'save' then | ||
saveMenu.transform:SetLocalPosition(positions.visible) | ||
pauseMenu.transform:SetLocalPosition(positions.hidden) | ||
end | ||
else | ||
saveMenu.transform:SetLocalPosition(positions.hidden) | ||
pauseMenu.transform:SetLocalPosition(positions.hidden) | ||
end | ||
|
||
-- Saved text | ||
if savedTick > 3*60 then | ||
savedText:SetOpacity(0) | ||
savedTick = 0 | ||
end | ||
|
||
-- Mouse locking | ||
if ingame then CS.Input.LockMouse() else CS.Input.UnlockMouse() end | ||
|
||
|
||
end | ||
|
||
function SaveWorld(id) | ||
CS.Storage.Save( | ||
"World" .. id, | ||
{seed = worldSeed, biomeCoords = biomeCoords, worldType = worldType, placedBlocks = placedBlocks}, | ||
function(err) print(err ~= nil and "Unknown error" or "Successfully saved world " .. id) end | ||
) | ||
ingame = not ingame | ||
currentMenu = 'pause' | ||
savedText:SetOpacity(1) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.