Button Issue

So Every time i add the button code in the update function it doesn’t show anything and then crashes.

Welcome to the forums.

Please don’t use screenshots of code, include it directly in a code block in your message, or if it is longer like yours use a service like github gist or pastebin.

As for your error it seems the lime http server crashes, scroll up the terminal to see an error message.
I don’t think it has anything to do with your code.

Ok sorry and here are the errors on html


but on the windows build it just crashes after the haxeflixel intro.
ActualText:

crbug/1173575, non-JS module files deprecated.
(index)꞉18:10:6587
Uncaught TypeError TypeError: Cannot read properties of null (reading 'overlapsPoint')
    at overlaps (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:24128:20)
    at update (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:5220:24)
    at tryUpdate (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:5162:9)
    at update (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:12014:15)
    at step (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:11989:8)
    at onEnterFrame (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:11923:11)
    at __dispatchEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:1175:15)
    at __dispatch (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:2312:73)
    at __broadcastEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:83040:18)
    at __onLimeRender (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:84117:8)
    at dispatch (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:64527:16)
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:355:23)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---
    at handleApplicationEvent (C:\Users\nicco\Downloads\GameHaxe\SwicthingLigths\export\html5\bin\SwicthingLights.js:365:10)
    --- requestAnimationFrame ---

Ah I see the terminal also shows error from the game.

You should run the game in debug mode, you’d have the position in the Haxe files instead of the output js, which you could use to find the issue.

The relevant point is:

Cannot read properties of null (reading 'overlapsPoint')

which should come from your line 32:

if (FxlG.mouse.overlaps(ligh))

here ligh is this.ligh which is null because you didn’t set it to any value.

Line 17 you do var ligh = new FlxSprite(); so the variable only exists in the create function.

You’d want to remove the var to set the instance variable instead.
Same for var ull.

oh ok thanks for showing me the problem and how to fix it