This commit is contained in:
scientiist
2020-02-26 15:05:34 -06:00
parent c9e7049eec
commit 0f2fc68b80
11 changed files with 131 additions and 49 deletions

BIN
assets/items/luger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

View File

@@ -37,6 +37,6 @@ return {
CHUNK_SIMULATION_RADIUS = 2,
CHUNK_BUFFER_RADIUS = 3,
CHUNK_COORDINATE_DIVIDER = "_",
GAME_VERSION = "2.9 alpha",
DATA_VERSION = "16",
GAME_VERSION = "1.0 beta",
DATA_VERSION = "18",
}

View File

@@ -189,6 +189,22 @@ armour_item:new("COBALT_LEGGINGS", {
protection = 6,
})
armour_item:new("VIKING_HELMET", {
displayname = "NORDIC STEEL HELM",
helmet = true,
})
armour_item:new("VIKING_CHAIN", {
displayname = "NORDIC STEEL CHAINMAIL",
chestplate = true,
})
armour_item:new("VIKING_LEGGINGS", {
displayname = "NORDIC STEEL LEGGINGS",
leggings = true,
})
armour_item:new("WITCH_HAT", {
set = "witch",
texture = "helmet.png",
@@ -208,7 +224,6 @@ armour_item:new("WITCH_DRESS_BOTTOM", {
leggings = true,
})
baseitem:new("BART", {
accessory = true,
})

View File

@@ -44,7 +44,6 @@ bullet:new("NANOBULLET", {
tooltip = ""
})
local function firearm_use(gun, player)
local unit = (jutils.vec2.new(input.getTransformedMouse())-player.position):unitvec()
local summonPos = player.position + unit*16
@@ -52,39 +51,31 @@ local function firearm_use(gun, player)
local acc = math.random(gun.inaccuracy) - (gun.inaccuracy/2)
local dir = jutils.vec2.fromAngleRadians(math.rad(unit:angle()+acc))
--local dir = unit * inaccuracy
local bullet_type
if player.gui.inventory:hasItem(itemlist.BULLET.id, 1) then
player.gui.inventory:removeItem(itemlist.BULLET.id, 1)
local bullet = player.world:addEntity("bullet", summonPos, dir, gun.power, gun.damage)
return true, bullet
bullet_type = "bullet"
end
if player.gui.inventory:hasItem(itemlist.SILVER_BULLET.id, 1) then
player.gui.inventory:removeItem(itemlist.SILVER_BULLET.id, 1)
-- todo: silver bullet spawning
local bullet = player.world:addEntity("silverbullet", summonPos, dir, gun.power, gun.damage)
return true, bullet
bullet_type = "silver_bullet"
end
if player.gui.inventory:hasItem(itemlist.NANOBULLET.id, 1) then
player.gui.inventory:removeItem(itemlist.NANOBULLET.id, 1)
-- todo: nanobullet spawning
local bullet = player.world:addEntity("bullet", summonPos, dir, gun.power, gun.damage)
return true, bullet
bullet_type = "bullet"
end
if player.gui.inventory:hasItem(itemlist.HOLY_BULLET.id, 1) then
player.gui.inventory:removeItem(itemlist.HOLY_BULLET.id, 1)
-- todo: holy bullet spawning
local bullet = player.world:addEntity("bullet", summonPos, dir, gun.power, gun.damage)
return true, bullet
bullet_type = "bullet"
end
if player.gui.inventory:hasItem(itemlist.FRAGMENT_BULLET.id, 1) then
player.gui.inventory:removeItem(itemlist.FRAGMENT_BULLET.id, 1)
-- todo: holy bullet spawning
local bullet = player.world:addEntity("bullet", summonPos, dir, gun.power, gun.damage)
bullet_type = "bullet"
end
if bullet_type then
local bullet = player.world:addEntity(bullet_type, summonPos, dir, gun.power, gun.damage)
return true, bullet
end
end
@@ -114,7 +105,7 @@ gun:new("FLINTLOCK", {
gun:new("LUGER", {
displayname = "LUGER",
speed = 1,
texture = "flintlock.png",
texture = "luger.png",
stack = 1,
use = firearm_use,
damage = 10,
@@ -187,14 +178,12 @@ baseitem:new("FLAMING_ARROW", {
slingshot item:
]]
baseitem:new("BOW", {
displayname = "TEST BOW",
speed = 1/2,
texture = "bow.png",
playeranim = pointanim(true),
inWorldScale = 2,
stack = 1,
use = function(self, player)
local bow = baseitem:subclass("Bow") do
bow.stack = 1
bow.inWorldScale = 1
bow.playeranim = pointanim(true)
bow.use = function(self, player)
if player.gui.inventory:hasItem(itemlist.FLAMING_ARROW.id, 1) then
player.gui.inventory:removeItem(itemlist.FLAMING_ARROW.id, 1)
@@ -213,10 +202,20 @@ baseitem:new("BOW", {
arrow.velocity = unit*350
return true
end
end,
end
end
bow:new("WOODEN_BOW", {
displayname = "WOODEN BOW",
speed = 1/2,
texture = "bow.png",
})
bow:new("COPPER_BOW", {
displayname = "COPPER BOW",
speed = 1/3,
texture = "bow.png",
})
consumable:new("BOMB", {
texture = "bomb.png",
@@ -292,8 +291,6 @@ consumable:new("DYNAMITE", {
end
})
local SWORD_TOOLTIP =
[[
{speed} Speed

View File

@@ -153,6 +153,27 @@ newtile("GREEN_TORCH", {
hardness = 1,
})
newtile("ICE_TORCH", {
color = {0.7, 0.7, 0.9},
solid = false,
collide = false,
animation = {
[1] = "torch_a",
[2] = "torch_b",
[3] = "torch_c",
[4] = "torch_d",
},
tags = {"fakeempty"},
light = {0.75, 0.75, 1.5},
tileupdate = function(world, x, y)
if not torchValid(world, x, y) then
world:setTile(x, y, tilelist.AIR.id, true)
end
end,
validplacement = torchValid,
hardness = 1,
})
local function ropeValid(world, x, y)
if not (isSolid(world:getTile(x, y-1)) or world:getTile(x, y-1)==tilelist.ROPE.id) then
return false
@@ -288,6 +309,10 @@ brickTile("RED_BRICK", {0.9, 0.5, 0.5}) -- CLAY
brickTile("DARK_BRICK", {0.2, 0.2, 0.2})
brickTile("WHITE_BRICK", { 1, 1, 1})
brickTile("MUD_BRICK", {0.4, 0.2, 0.1})
brickTile("ICE_BRICK", {0.7, 0.7, 0.85})
newtile("MOSSY_GRAY_BRICK", {
texture = "mossybrick",
hardness = 3,
@@ -338,4 +363,16 @@ newtile("SULPHUR", {
texture = "ore",
color = {1.5, 1.5, 0},
hardness = 1,
})
newtile("SNOW", {
texture = "soil",
color = {1,1,1},
hardness = 1,
})
newtile("ICE", {
texture = "soil",
color = {0.35, 0.35, 0.9, 0.8},
hardness = 2,
})

View File

@@ -59,8 +59,4 @@ newtile("WOOB", {
newtile("BUBBLEGUM", {
})
newtile("ICE", {
texture = "glass",
})

View File

@@ -243,4 +243,9 @@ background("WHITE_BRICK", {
texture = "brick2",
})
background("ICE_BRICK", {
color = {0.7, 0.7, 0.85},
texture = "brick2",
})
return bgcollector

View File

@@ -18,7 +18,7 @@ function item_pickup:update(dt)
floating_text.update(self, dt)
for _, entity in pairs(self.world.entities) do
if entity:isA("ItemPickupText") and entity ~= self then
if self.position:distance(entity.position) < 15 then
if self.position:distance(entity.position) < 30 then
if self.name == entity.name and self.age < entity.age then
self.amount = self.amount + entity.amount
self.text = self.name.." x"..self.amount

View File

@@ -31,7 +31,7 @@ local music = nil
return function(args)
-- globals
_G.ENTITY_DEBUG = false
_G.ENTITY_DEBUG = true
_G.FULLBRIGHT = false
_G.NO_TEXTURE = false
_G.RUN_WITH_STEAM = false
@@ -92,7 +92,7 @@ return function(args)
show_debug_info = true
in_menu = false
gameworld = world.new("gen_world", 0)
gameworld.no_save = true
_G.NO_SAVE = true
gameworld.camera.zoom = 1.5
gameworld.worldtime = 12*60
local p = gameworld:getPlayer()

View File

@@ -104,8 +104,6 @@ local scene = jui.scene:new({}, {
})
})
local splash_ui = jui.scene:new({}, {
rect = jui.layoutbox:new({
scaleSize = jutils.vec2.new(0.75, 0.75),
@@ -195,6 +193,22 @@ local world_name_input = jui.textinput:new({
end
})
local world_seed_input = jui.textinput:new({
defaultText = "0",
grabFocusOnReturn = true,
clearOnReturn = false,
clearTextOnFocus = true,
clearDefaultOnFocus = true,
isFocused = true,
font = guiutil.fonts.font_16,
textColor = {1, 1, 1},
textXAlign = "center",
textYAlign = "bottom",
onInput = function(self, text)
end
})
new_world_ui = jui.scene:new({}, {
title_box = jui.layoutbox:new({
pixelSize = vec2.new(0, 30),
@@ -210,13 +224,34 @@ new_world_ui = jui.scene:new({}, {
})
}),
box2 = jui.layoutbox:new({
pixelSize = vec2.new(500, 40),
scalePosition = vec2.new(0.5, 0.5),
pixelPosition = vec2.new(-250, 20),
}, {
seedtxt = jui.text:new({
text = "World Seed:",
textYAlign = "top",
textXAlign = "center",
textColor = {0.8, 0.8, 0.8},
font = guiutil.fonts.font_16,
}),
secondlilbox = jui.rectangle:new({
scaleSize = vec2.new(0.5, 0.5),
scalePosition = vec2.new(0.25, 0.5),
backgroundColor = {0.15, 0.15, 0.15},
borderColor = {0.25, 0.25, 0.25},
}, {
input = world_seed_input,
})
}),
box = jui.layoutbox:new({
pixelSize = vec2.new(500, 40),
scalePosition = vec2.new(0.5, 0.5),
pixelPosition = vec2.new(-250, -20),
}, {
txt = jui.text:new({
worldtxt = jui.text:new({
text = "World Name:",
textYAlign = "top",
textXAlign = "center",
@@ -230,10 +265,9 @@ new_world_ui = jui.scene:new({}, {
borderColor = {0.25, 0.25, 0.25}
}, {
input = world_name_input,
})
}),
}),
infotext = jui.text:new({
text = "ENTER: Confirm\tESCAPE: Back",
@@ -245,7 +279,6 @@ new_world_ui = jui.scene:new({}, {
})
local function world_load_box(worldname, data)
local box = jui.rectangle:new({
backgroundColor = {1, 1, 1, 0},
scaleSize = jutils.vec2.new(1, 0),

View File

@@ -8,7 +8,6 @@ local noise = {}
local seed = -(4444)
function noise.octave_1d(x, octaves, persistence)
local total = 0