aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/characters/characters-data.lua16
-rw-r--r--assets/gui/.DS_Storebin6148 -> 6148 bytes
-rw-r--r--assets/scripts/local2P.lua79
3 files changed, 61 insertions, 34 deletions
diff --git a/assets/characters/characters-data.lua b/assets/characters/characters-data.lua
index 8b8ca4b..f0e0b42 100644
--- a/assets/characters/characters-data.lua
+++ b/assets/characters/characters-data.lua
@@ -2,37 +2,37 @@ return {
{
name = "Cobalt Phantom",
lives = 3,
- speed = 5,
+ speed = 240,
moves = {"teleportation", "quick_dashes", "smoke_screens", "strikes_from_the_shadows"},
hit_strength = 15,
asset_dir = "assets/characters/Cobalt Phantom",
- jump_strength = 23.65,
+ jump_strength = 925, -- was 1419 → dropped ~35%
},
{
name = "Emerald Venom",
lives = 4,
- speed = 4,
+ speed = 192,
moves = {"snake_whip", "venom_bite", "poison_of_the_past"},
hit_strength = 12,
asset_dir = "assets/characters/Emerald Venom",
- jump_strength = 25.4,
+ jump_strength = 990, -- was 1524
},
{
name = "Golden Radiance",
lives = 5,
- speed = 8,
+ speed = 384,
moves = {"solar_boom", "flashbang", "flare_frenzy"},
hit_strength = 13,
asset_dir = "assets/characters/Golden Radiance",
- jump_strength = 23.1,
+ jump_strength = 890, -- was 1386
},
{
name = "Crimson Reaper",
lives = 2,
- speed = 2,
+ speed = 96,
moves = {"soul_slash", "deaths_reach", "phantom_step", "grim_harvest"},
hit_strength = 17,
asset_dir = "assets/characters/Crimson Reaper",
- jump_strength = 27.7,
+ jump_strength = 1050, -- was 1662
}
}
diff --git a/assets/gui/.DS_Store b/assets/gui/.DS_Store
index df5b5e4..cc495a7 100644
--- a/assets/gui/.DS_Store
+++ b/assets/gui/.DS_Store
Binary files differ
diff --git a/assets/scripts/local2P.lua b/assets/scripts/local2P.lua
index 61262b2..7413406 100644
--- a/assets/scripts/local2P.lua
+++ b/assets/scripts/local2P.lua
@@ -4,14 +4,16 @@ backgrounds = require("assets.backgrounds.backgrounds-data")
sprite_height = 128
sprite_width = 64
-deltaTimeMultiplier = 60
-
groundTiles = {
{ x = 250, y = HEIGHT - 300, width = 200, height = 30 },
{ x = WIDTH - 250 - 200, y = HEIGHT - 300, width = 200, height = 30 },
{ x = 0, y = HEIGHT - 100, width = WIDTH, height = 100 }
}
+knockbackMultiplierX = 35.4
+knockbackMultiplierY = 8.73
+minimalKnockbackMultiplierY = 40.3
+
function SafeInitCharacter(character, default_x, default_y)
character.x = default_x
@@ -24,6 +26,7 @@ function SafeInitCharacter(character, default_x, default_y)
character.knockback_counter = 0
character.combo_chain = 0
character.can_apply_knockback = false
+ character.facing = "right"
end
function Setup()
@@ -33,7 +36,7 @@ function Setup()
SafeInitCharacter(player2Character, WIDTH - 250 - (250 / 2), 150)
end
-gravity = 1.2 -- POSITIVE gravity
+gravity = 1570
function DrawGroundTiles()
for _, tile in ipairs(groundTiles) do
@@ -79,7 +82,22 @@ function IsTouchingWall(character, direction)
local tileBottom = tile.y + tile.height
local tileTop = tile.y
- local verticalOverlap = charBottom > tileTop and charTop < tileBottom
+ local verticalOverlapAmount = math.min(charBottom, tileBottom) - math.max(charTop, tileTop)
+ local verticalOverlap = verticalOverlapAmount > 12
+
+ -- New: Check if tile is within a certain horizontal range before collision test
+ local horizontalDistance
+ if direction == "left" then
+ horizontalDistance = character.x - (tile.x + tile.width)
+ if horizontalDistance > 15 then -- Only check if tile is within 15 pixels to the left
+ goto continue
+ end
+ elseif direction == "right" then
+ horizontalDistance = tile.x - (character.x + sprite_width)
+ if horizontalDistance > 15 then -- Only check if tile is within 15 pixels to the right
+ goto continue
+ end
+ end
if direction == "left" then
local nextX = character.x - character.speed
@@ -98,6 +116,7 @@ function IsTouchingWall(character, direction)
return true
end
end
+ ::continue::
end
return false
end
@@ -111,6 +130,7 @@ function HandleP1Input()
if Input.isKeyDown("D") then
if not IsTouchingWall(player1Character, "right") then
player1Character.x_velocity = player1Character.speed
+ player1Character.facing = "right"
else
player1Character.x_velocity = 0
end
@@ -118,6 +138,7 @@ function HandleP1Input()
if Input.isKeyDown("A") then
if not IsTouchingWall(player1Character, "left") then
player1Character.x_velocity = -player1Character.speed
+ player1Character.facing = "left"
else
player1Character.x_velocity = 0
end
@@ -137,6 +158,7 @@ function HandleP2Input()
if Input.isKeyDown("RIGHT") then
if not IsTouchingWall(player2Character, "right") then
player2Character.x_velocity = player2Character.speed
+ player2Character.facing = "right"
else
player2Character.x_velocity = 0
end
@@ -144,12 +166,13 @@ function HandleP2Input()
if Input.isKeyDown("LEFT") then
if not IsTouchingWall(player2Character, "left") then
player2Character.x_velocity = -player2Character.speed
+ player2Character.facing = "left"
else
player2Character.x_velocity = 0
end
end
- if Input.isKeyPressedOnce("Right Alt") or Input.isKeyPressedOnce("Right Option") then
+ if Input.isKeyPressedOnce("L") then
PerformPunch(player2Character, player1Character)
end
end
@@ -196,27 +219,19 @@ function Respawn(character)
end
function ApplyKnockback(attacker, target)
- local knockbackMultiplierX = 0.47
- local knockbackMultiplierY = 0.01
- target.y_velocity = -10 - (target.knockback_counter * knockbackMultiplierY)
-
- local direction = 1
- if target.x < attacker.x then
- direction = -1
- end
+ local direction = attacker.facing == "left" and -1 or 1
+ local scaledY = -10 - (target.knockback_counter * knockbackMultiplierY)
+ target.y_velocity = math.max(-950, scaledY) -- clamp Y knockback
target.x_velocity = target.knockback_counter * knockbackMultiplierX * direction
- -- target.x = target.x + direction * (target.knockback_counter * 0.7)
end
function ApplyMinimalKnockback(attacker, target)
- local knockbackMultiplierX = 0.47
- local knockbackMultiplierY = 0.01
local knockbackCountMinimal = 5
- target.y_velocity = -10 - (knockbackCountMinimal * knockbackMultiplierY)
+ target.y_velocity = -10 - (knockbackCountMinimal * minimalKnockbackMultiplierY)
local direction = 1
- if target.x < attacker.x then
+ if attacker.facing == "left" then
direction = -1
end
@@ -254,7 +269,7 @@ function PerformPunch(attacker, target)
local punch_height = 80
-- Determine direction of target relative to attacker
- local punch_direction = (target.x > attacker.x) and "right" or "left"
+ local punch_direction = attacker.facing
-- Set punch sprite
attacker.current_sprite = attacker.asset_dir .. "/sprites/punch_" .. punch_direction .. ".png"
@@ -288,16 +303,20 @@ function PerformPunch(attacker, target)
end
if isColliding(hitbox, targetHitbox) then
- RegisterHit(attacker, target, attacker.hit_strength)
+ Timer.after(0.05, function ()
+ RegisterHit(attacker, target, attacker.hit_strength)
+ end)
end
end
function ApplyPhysics(character)
- local deltaTimeMultiplier = 60 -- Target 60FPS
- character.y_velocity = character.y_velocity + gravity * deltaTime * deltaTimeMultiplier
- character.y = character.y + character.y_velocity * deltaTime * deltaTimeMultiplier
- character.x = character.x + character.x_velocity * deltaTime * deltaTimeMultiplier
- character.x_velocity = character.x_velocity * 0.99
+ character.y_velocity = character.y_velocity + gravity * deltaTime
+ character.y = character.y + character.y_velocity * deltaTime
+ character.x = character.x + character.x_velocity * deltaTime
+ character.x_velocity = character.x_velocity * 0.88
+
+ print(character.name, character.x_velocity)
+ print(character.name, character.y_velocity)
if character.y_velocity > 0 then
-- Falling
@@ -317,6 +336,14 @@ function ApplyPhysics(character)
if character.y > HEIGHT + 50 then
KillPlayer(character)
end
+
+ if character.x < -50 then
+ KillPlayer(character)
+ end
+
+ if character.x > WIDTH + 50 then
+ KillPlayer(character)
+ end
end
function Update()
@@ -340,4 +367,4 @@ function Update()
-- Timer
Timer.update(deltaTime)
-end
+end \ No newline at end of file