winner_joiner

Mar 10, 2023 21:03
this is a updated create function for matter for my other demo, from here I think you can, extrapolate the other parts, when in doubt just check the documentation. It is really very good.
Mar 10, 2023 21:02
I no expert, but it seems straight forward: ```function create () {

let graphics = this.make.graphics();
graphics.fillStyle(0x933AFF);
graphics.fillRect(0, 0, 10, 10);
graphics.generateTexture('tiles', 10, 10);

let map = this.make.tilemap({ key: 'map', tileWidth: 8, tileHeight: 8 });
let tiles = map.addTilesetImage('tiles', 'tiles');
let layer = map.createLayer(0, tiles, 0, 0);
let objectLayer = map.getObjectLayer( 'ObjectLayer1' );

for( let obj of objectLayer.objects ){
let { width, height } = obj;
Mar 10, 2023 15:05
@MohsinUddinAbir Sure thing, check out this example of the phaser exxample page. it shows how you can setup matterjy with a tilemap and how the collisions work phaser.io/examples/v3/view/tilemap/tileset-collision-shapes and this interactive example labs.phaser.io/edit.html?src=src/tilemap/… I hope this can help you
Mar 8, 2023 06:07
(for that use the matter engine here you can find the official demos phaser.io/examples/v3/category/physics/matterjs) btw.: you have to hit reply on a message in the chat, it not don't recieve notifications, I just saw the message because I checked it just in case.
Mar 8, 2023 06:07
@MohsinUddinAbir it is not really easy possible with arcade physics. you could calculate it yourself with the function overlap or collide (link to the documentation: newdocs.phaser.io/docs/3.55.2/focus/…) you could use the collide and process callbacks to calculate the collisions. But out of the box it won't work.
Feb 25, 2023 19:50
btw: the phaser documentation is pretty good photonstorm.github.io/phaser3-docs/Phaser.Tilemaps.Tilemap.html and also the official demo cover many points (like phaser.io/examples/v3/view/tilemap/tileset-collision-shapes ) just beware some examples use matter physics
Feb 25, 2023 18:32
@MohsinUddinAbir I updated my answer to show this.
Feb 25, 2023 18:20
You would only have to use if/else blocks if(obj.rectangle){ ... }else if(obj.ellipse){ ... }else if(obj.point){... } in the for-loop
Feb 25, 2023 18:18
for rectangle, ellipse and point. As mentioned before. Arcade physics doesn't support any other geometric shape
Feb 25, 2023 18:17
@MohsinUddinAbir You can use custom properties, but phaser already has the basic properties covered photonstorm.github.io/phaser3-docs/…
Feb 25, 2023 06:47
@MohsinUddinAbir I updated my answer with a running demo, I hope this help. :)
Feb 25, 2023 04:56
if ellipse.setCircledoesn't work it must be ellipse.body.setCircle. But I will write a small demo, and confirm this (in the next few). minutes
Feb 24, 2023 23:00
And armed with this knowledge, I would only create objects Tiled, that are rectangles or circles. (like this you will know how the circular/rectangle body will be in the game)
Feb 24, 2023 23:00
The best way to get a circle for an object would be ellipse.setCircle(obj.width/2) sadly no real ellipse is possible. (I also updated the answer)
Feb 24, 2023 23:00
@MohsinUddinAbir yes I know, and that i wrote in the answer. arcade physics just knows boxes and with the setCircle function just circle bodies. if you can work around that limitations you havr to use the matterjs engine.
 

Sandbox

Where you can play with regular chat features (except flagging...
Feb 6, 2023 08:34
test
 

JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
Feb 6, 2023 08:33
check out this link for many examples and explaination developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
Feb 6, 2023 08:29
@MileMijatović I assume because destructuring is trying to access properties from an object and undefined is not really an object
 

Multilevel Dropdown in sidebar...

Multilevel Dropdown in sidebar using HTML,CSS & JS
Nov 17, 2019 07:23
No Problem, all the best learning Javascript. have a nice day/night/... :D
Nov 17, 2019 07:03
it should be no problem, because of the new css-class
Nov 17, 2019 07:02
we created in the loop, I will post the code with some comments in to your quest7answer
Nov 17, 2019 07:02
It is for binding the Button Click event, but only for the new buttons
Nov 17, 2019 07:01
Okay this code is from your HTML,
Nov 17, 2019 06:59
okay, can also explain
Nov 17, 2019 06:59
and part two starting with
_var newButtons = ..._
Nov 17, 2019 06:58
Part one is your loop, i just added a new class new-buttons
Nov 17, 2019 06:57
function testing(){
console.info("test")
var newHTML = "";
for(i=0;i<5;i++){
newHTML +=`<button class="dropdown-btn new-buttons">
<i class="fa fa-sticky-note left-icon"></i>P${i}<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-container" >
<a onclick="generateqrrr();" style="color:white;">Generate QRcode</a>
<a onclick="studentlistrr();" style="color:white;">Student list</a>
<a onclick="manualattendancerr();" style="color:white;">Manual Attendance</a>
</div>
`
}
document.getElementById('testd').innerHTML += newHTML;
Nov 17, 2019 06:57
It took a bit longer, ... had a bug :D
Nov 17, 2019 06:43
it is not great (production code), but should work
Nov 17, 2019 06:42
No Problem, I will rewirte your test function, so that it works
Nov 17, 2019 06:40
and the new buttons come later :D
Nov 17, 2019 06:40
because you attacht the events on load
Nov 17, 2019 06:39
... the new buttons don't have an event for clicking
Nov 17, 2019 06:39
every thing is correct the only problem is...
Nov 17, 2019 06:37
no problem, it is fun :D
Nov 17, 2019 06:36
okay now i understand, .... just a moment
Nov 17, 2019 06:32
perfect will read it quick
Nov 17, 2019 06:32
I possible taht would help alot
Nov 17, 2019 06:30
which styling are you using? currently I only see button :D only that i can have a beter picture
Nov 17, 2019 06:29
so the loop that you posted are the subjects? right?
Nov 17, 2019 06:25
One level or multiple?
Nov 17, 2019 06:24
paste
Nov 17, 2019 06:24
just past it in the chat
Nov 17, 2019 06:23
okay
Nov 17, 2019 06:23
for(i=0;i<5;i++){
var parent = i==0?'testd':'testd' + (i-1);
document.getElementById(parent).innerHTML+=`<button class="dropdown-btn" ><i class="fa fa-sticky-note left-icon"></i>P${i}
<i class="fa fa-caret-down"></i>
</button> <div class="dropdown-container" id="testd${i}" >
<a onclick="generateqrrr();" style="color:white;">Generate QRcode</a>
<a onclick="studentlistrr();" style="color:white;">Student list</a>
<a onclick="manualattendancerr();" style="color:white;">Manual Attendance</a>
</div>
Nov 17, 2019 06:23
yes it pops up after some comments :D
Nov 17, 2019 06:23
i think i have the solution
Nov 17, 2019 06:23
HI
Nov 17, 2019 06:18
Hello
 
May 28, 2018 20:06
Okay, thanks, than have a nice night,. Al the best.