-
I’m calculating delta time for use in my animations. I notice randomly i get a spike in dt causing my player to fall through the floor. it happens after a minute or two if i dont touch the screen. I’m sure this is the cause because I’m printing it when it’s greater than 0.1. this is my method of calculating dt
local dt = 0 local lastUpdate = 0 function getDeltaTime() if lastUpdate == 0 then dt = 0 else dt = (system.getTimer( ) - lastUpdate) / 1000 end lastUpdate = system.getTimer( ) end
any idea why there are huge spikes in dt?
-
I’m using Dusk which is a great library. I add it to my project like so.
local dusk = require “Dusk.Dusk”
right now the dusk folder is sitting in the root of my project. i wanted to sitck it in a lib folder. i try including it this way
local dusk = require "lib/Dusk.Dusk"
or this way
local dusk = require "lib.Dusk.Dusk"
with the first way it says these files must be included using a “.” and in the second method it says
module ‘Dusk.dusk_core.core’ not found:
i’d figure this would be pretty straightforward,not sure what im doing wrong.
- my third question is about accessing variables from the scene in an outside class. for example, lets say i create a “Player” file with all the functionality related to my player. I add the player in game.lua, and I want to call a function from my “game.lua” file within “player.lua” whats the best way to reach those functions or varaiables?