adjusted hook to be toggle; renamed HasPressed to CheckPressed (keybind)
This commit is contained in:
parent
6566e6fbab
commit
9d1e59b46a
|
@ -1,7 +1,8 @@
|
|||
function EditorStep()
|
||||
palette = palette or false
|
||||
AnimateTiles()
|
||||
if Keybind:HasPressed(Keybind.editor.palette) then
|
||||
|
||||
if Keybind:CheckPressed(Keybind.editor.palette) then
|
||||
if palette then
|
||||
palette = false
|
||||
palette_scroll_x = nil
|
||||
|
@ -26,7 +27,7 @@ function EditorStep()
|
|||
end
|
||||
|
||||
if palette then
|
||||
if Keybind:HasPressed(Keybind.debug.debug) then
|
||||
if Keybind:CheckPressed(Keybind.debug.debug) then
|
||||
local next = false
|
||||
local export = nil
|
||||
for k, v in pairs(tileset) do
|
||||
|
@ -51,11 +52,11 @@ function EditorStep()
|
|||
end
|
||||
end
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.reload) then
|
||||
if Keybind:CheckPressed(Keybind.debug.reload) then
|
||||
ExportLevel("test")
|
||||
end
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.editor) then
|
||||
if Keybind:CheckPressed(Keybind.debug.editor) then
|
||||
editor_mode = false
|
||||
TileCreateObjects()
|
||||
end
|
||||
|
@ -126,10 +127,10 @@ function EditorDoEdit()
|
|||
end
|
||||
LevelReloadTiles()
|
||||
|
||||
elseif Keybind:HasPressed(Keybind.generic.lshift) then
|
||||
elseif Keybind:CheckPressed(Keybind.generic.lshift) then
|
||||
LevelExpandCanvas(math.sign(expand_h),math.sign(expand_v))
|
||||
LevelReloadTiles()
|
||||
elseif Keybind:HasPressed(Keybind.generic.lctrl) then
|
||||
elseif Keybind:CheckPressed(Keybind.generic.lctrl) then
|
||||
LevelReduceCanvas(math.sign(expand_h),math.sign(expand_v))
|
||||
LevelReloadTiles()
|
||||
end
|
||||
|
|
|
@ -140,7 +140,10 @@ function Player:Smart()
|
|||
self.isDashing = false
|
||||
end
|
||||
|
||||
if Keybind:CheckDown(Keybind.move.hook) then
|
||||
if Keybind:CheckPressed(Keybind.move.hook) then
|
||||
if self.isHooked then
|
||||
self.isHooked = false
|
||||
else
|
||||
local anchor = self:CheckNearest("decoration",self.hookDistance)
|
||||
if anchor then
|
||||
self.isHooked = true
|
||||
|
@ -149,8 +152,7 @@ function Player:Smart()
|
|||
y = anchor.pos.y
|
||||
}
|
||||
end
|
||||
else
|
||||
self.isHooked = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -194,9 +196,19 @@ function Player:DoPhysics()
|
|||
if self.isHooked then
|
||||
local hook = Vector(self.pos.x, self.pos.y, self.hookAnchor.x, self.hookAnchor.y)
|
||||
if GetVectorValue(hook) > self.hookedDistance then
|
||||
local hook_angle = GetAngleFromVector(hook[1],hook[2])
|
||||
local pos_x = self.hookAnchor.x + self.hookedDistance * math.cos(-math.rad(180)+hook_angle)
|
||||
local pos_y = self.hookAnchor.y + self.hookedDistance * math.sin(-math.rad(180)+hook_angle)
|
||||
local particle_data = {
|
||||
animation = self.body,
|
||||
sprite_tint = HEX2RGB("#fed100"),
|
||||
sprite_alpha = 0.5,
|
||||
sprite_flip = {
|
||||
x = self.sprite_flip.x,
|
||||
y = self.sprite_flip.y
|
||||
}
|
||||
}
|
||||
Particle:New(self.pos.x,self.pos.y,particle_data)
|
||||
local hook_angle = GetAngleFromVector(hook[1],hook[2])-math.rad(180)
|
||||
local pos_x = self.hookAnchor.x + self.hookedDistance * math.cos(hook_angle)
|
||||
local pos_y = self.hookAnchor.y + self.hookedDistance * math.sin(hook_angle)
|
||||
self.vel.x = self.vel.x + pos_x - self.pos.x
|
||||
self.vel.y = self.vel.y + pos_y - self.pos.y
|
||||
self.pos.x = pos_x
|
||||
|
@ -206,7 +218,7 @@ function Player:DoPhysics()
|
|||
|
||||
|
||||
if self.canFall then
|
||||
-- not in dash or hook; fall normally
|
||||
-- not in dash
|
||||
self.dashTimer = 0
|
||||
self.vel.y = self.vel.y + gravity
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ function GameStep()
|
|||
Camera:positionCenterAt(main_Player.pos.x, main_Player.pos.y)
|
||||
--camera:positionAt(main_Player.pos.x, main_Player.pos.y,game.width,game.height)
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.debug) then
|
||||
if Keybind:CheckPressed(Keybind.debug.debug) then
|
||||
if debug then
|
||||
debug = false
|
||||
debug_collision = true
|
||||
|
@ -31,19 +31,19 @@ function GameStep()
|
|||
end
|
||||
end
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.reposition) then
|
||||
if Keybind:CheckPressed(Keybind.debug.reposition) then
|
||||
if not editor_mode then
|
||||
main_Player.pos.x, main_Player.pos.y = 16,-10
|
||||
end
|
||||
end
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.reload) then
|
||||
if Keybind:CheckPressed(Keybind.debug.reload) then
|
||||
MenuClear()
|
||||
menu_type = "dialog"
|
||||
MenuInit("dialog",DialogSequence.Example)
|
||||
end
|
||||
|
||||
if Keybind:HasPressed(Keybind.debug.editor) then
|
||||
if Keybind:CheckPressed(Keybind.debug.editor) then
|
||||
editor_mode = true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ function Keybind:CheckDown(action)
|
|||
return false
|
||||
end
|
||||
|
||||
function Keybind:HasPressed(action)
|
||||
function Keybind:CheckPressed(action)
|
||||
if Keybind:CheckDown(action) then
|
||||
if not action.pressed then
|
||||
action.pressed = true
|
||||
|
|
2
main.lua
2
main.lua
|
@ -93,7 +93,7 @@ function love.update(dt)
|
|||
end
|
||||
|
||||
--keypressed
|
||||
if Keybind:HasPressed(Keybind.menu.pause) then
|
||||
if Keybind:CheckPressed(Keybind.menu.pause) then
|
||||
if do_pause then
|
||||
do_pause = false
|
||||
else
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
(*) Ideas
|
||||
( ) DO FLIES
|
||||
( ) DO UI
|
||||
( ) DO DAMAGE TO PLAYER
|
||||
|
||||
( ) Visual design
|
||||
(~) Multicolor palette depending on area, with 3 main colors
|
||||
(X) Library: Gold #fed100
|
||||
( )
|
||||
( ) Dialog
|
||||
( ) Fonts
|
||||
( ) Characters
|
||||
( ) Level design
|
||||
( ) Enemy design
|
||||
|
||||
( ) Gameplay design
|
||||
( ) Level design
|
||||
( ) Mechanic design
|
||||
( ) Entity design
|
||||
(~) FAIRY
|
||||
(X) basic movement
|
||||
(X) Fairy particles~~
|
||||
( ) more intelligent movement
|
||||
( ) avoid getting stuck to walls
|
||||
( ) Playtest tools
|
||||
|
||||
( ) Technical design
|
||||
(?) Input
|
||||
(X) ADDED KEYBINDS
|
||||
( )
|
||||
(?) Draw
|
||||
(X) REHANDLE ANIMATIONS
|
||||
(X) MAKE LIGHTING SYSTEM
|
||||
(X) Pixel perfect entity drawing
|
||||
( ) Pixel perfect lights
|
||||
(?) Player
|
||||
(X) MASKS FUNCTIONALITY
|
||||
( )
|
||||
(?) Physics
|
||||
(X) MAKE PHYSICS CONSISTENT
|
||||
(X) MAKE HITBOXES
|
||||
(X) PHYSICS BY FRAME
|
||||
(X) DEACTIVATE ARROWS WHEN STUCK
|
||||
( )
|
||||
(~) Dialog
|
||||
(X) Object and Basics
|
||||
( ) Fix font and align problems
|
||||
( ) Implement portrait
|
||||
(X) Translating framework
|
||||
( ) Debug tools
|
||||
( ) Audio and BGM
|
||||
(~) REMAKE LEVEL EDITOR
|
||||
(~) ADD WAY TO EDIT A LEVEL (EDITOR MODE)
|
||||
(X) SHOW PALETTE
|
||||
(X) PICK UP TILE FROM PALETTE
|
||||
(X) PLACE PICKED UP TILE
|
||||
( ) WAY TO INSERT ENTITIES IN THE LEVEL
|
||||
(X) ADD WAY TO SAVE A LEVEL
|
||||
|
||||
( ) Narrative design
|
||||
( ) Dialog
|
||||
( ) Characters
|
||||
( ) Area design
|
||||
( ) Translations
|
||||
( ) SPA "es_ES"
|
||||
( ) ENG "en_UK"
|
||||
( ) CAT "ca_ES"
|
||||
( ) HEON "Myrheonian"
|
Loading…
Reference in New Issue