Skip to content

Instantly share code, notes, and snippets.

@meeech
Last active November 24, 2021 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meeech/192fe5fcf0ca522c10f2b10b8dcb70b0 to your computer and use it in GitHub Desktop.
Save meeech/192fe5fcf0ca522c10f2b10b8dcb70b0 to your computer and use it in GitHub Desktop.
Just some notes during my first poke-through
Config = {
Map = "aduermael.hills"
}
Client.OnStart = function()
-- Defines a function to drop
-- the player above the map.
dropPlayer = function()
Player.Position = Number3(Map.Width * 0.5, Map.Height + 10, Map.Depth * 0.5) * Map.Scale
Player.Rotation = { 0, 0, 0 }
Player.Velocity = { 0, 0, 0 }
end
-- Call dropPlayer function:
dropPlayer()
World:AddChild(Player, true) -- keep world
end
Client.Tick = function(dt)
-- Game loop, executed ~30 times per second on each client.
-- Detect if player is falling,
-- drop it above the map when it happens.
if Player.Position.Y < -500 then
dropPlayer()
Player:TextBubble("💀 Oops!")
end
end
-- jump function, triggered with Action1
Client.Action1 = function()
if Player.IsOnGround then
Player.Velocity.Y = 100
end
end
--
-- Server code
--
Server.Tick = function(dt)
-- Server game loop, executed ~30 times per second on the server.
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment