is this possible? (this is a killer feature to me! )
Yes, it is working!! And it is a killer feature, you can use it (as far as I can see right now) to modify your update
loop.
(ā¦and change your game rules , that really is a killer feature, Iām currently wondering why Iām not using it more often ).
So, but just as depicted in the article, no class field refactoring etc.
Iām pondering how can you inject some code to be only executed once, since you can only hot-reload what is inside of update
(I guess? )
(btw welcome back, rahil )
Oh this is an idea how you can inject code only once I guess
class HotReload01 extends hxd.App {
var hotreload_version : Int = 0;
static function main() { new HotReload01(); }
override function init() {}
override function update(dt:Float) {
if( hotreload_version == 0 ) // for every new hot-reload increase 0 by one here (by hand)
callOnce();
// your game rules here ...
}
function callOnce() {
// some code here ... (to only be executed once)
// like e.g.: player.lifepoints = 1000
hotreload_version++;
trace('Hot-reload is now version = $hotreload_version');
}
}
after every recompile you just change this line of code by hand to
if( hotreload_version == 1 )
if( hotreload_version == 2 )
if( hotreload_version == 3 )
ā¦
Ahhhhh @AlienBuchner !!! <3 <3
Yesā¦ itās been a few lifetimes. I had to move country post-pandemic. Life happens. Itās all so stupid. Iām still not settled!
But recently, I was playing an old game āTetris Attackā (Puzzle League series) emulated through a physical arcade cabinet; It re-ignited my love for games. I thought about quickly re-making it in Haxe/Heaps but i discovered it was already remade in love2d/lua: panelattack.com. Anyway, itās got me in the mood for making and perfecting some old forgotten classic multiplayer competitive games.
Thatās such great news about hot reloading!!! You must be a pro game maker by now! Wow.
Glad to hear from you!