Creating a game with complex menu

55 views
Skip to first unread message

Mariusz Pasek

unread,
Aug 26, 2020, 4:23:24 PM8/26/20
to excaliburjs
Hi,

I was hoping to create a game that would contain a bit more complex menu (I want to make an online multiplayer mode with joining, etc.). To do that I'll need some sort of GUI, since the engine does not seem to be providing one I was thinking of simply using HTML elements. However whenever I'm creating game engine instance it seems to be stealing all of the events from my html objects (even when the game is paused or not started yet). I was wondering if there's some mode in which I could disable reading the user input completely from the engine and enable it later when needed. As a workaround I could do two things probably:
1) manually pass every event from Excalibur to GUI - but that seems very weird solution IMHO
2) do not create engine instance until the game starts, but that would mean that every time when user would like to go back to menu they'd have to reload the page (which is not very terrible, but just not elegant).

Please, let me know how could I deal with my problem :)

Cheers,
Mariusz

Kamran Ayub

unread,
Aug 27, 2020, 10:53:41 AM8/27/20
to excaliburjs

Ah strange my response didn't get posted to the group but I'll include the thread here.

🤦‍♂️ You are right! The snippets were made initially as I was migrating documentation so it's very possible they have typos/bugs. In fact, we'd happily accept a PR with those two fixes for the snippet if you are able to contribute!

--

Hi Kamran,

Thanks for quick reply, that's been exactly what I was looking for! I wonder however if this shouldn't be mentioned in ts snippet here - it seems to me that html UI won't work at all otherwise. And one small thing. In the same snippet the canvas id is root (canvasElementId: 'root',) shouldn't it be 'game' instead?

And many thanks for maintaining this engine :)


czw., 27 sie 2020 o 00:54 Kamran Ayub napisał(a):
There is a section in the docs that discusses PointerScope, which may be what you're looking for?

https://excaliburjs.com/docs/input#pointer-scope-window-vs-canvas

But in any case, yes we'd usually recommend native HTML UI since it's pretty powerful and you should be able to safely overlay it on top of the game canvas using z-indexing in CSS.

Mariusz Pasek

unread,
Aug 29, 2020, 4:21:28 AM8/29/20
to Kamran Ayub, excaliburjs
Sure thing, I’ll be happy to :) btw. I just noticed that the link to particle tester in the Effects category is broken.

Wiadomość napisana przez Kamran Ayub <kamra...@gmail.com> w dniu 27.08.2020, o godz. 16:53:


--
You received this message because you are subscribed to a topic in the Google Groups "excaliburjs" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/excaliburjs/OIJY6PZ1Iwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to excaliburjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/excaliburjs/41ee010d-aa84-4e76-9fbd-6b2262c82fc9n%40googlegroups.com.

Mariusz Pasek

unread,
Aug 29, 2020, 4:39:54 AM8/29/20
to Kamran Ayub, excaliburjs
Oh, wait. It worked on a different browser, never mind.

Wiadomość napisana przez Mariusz Pasek <pasi...@gmail.com> w dniu 29.08.2020, o godz. 10:21:


Reply all
Reply to author
Forward
0 new messages