mikechambers / examplesbymesh Goto Github PK
View Code? Open in Web Editor NEWVarious examples and code created and shared by Mike Chambers
Home Page: http://www.mikechambers.com
Various examples and code created and shared by Mike Chambers
Home Page: http://www.mikechambers.com
I am trying to use this QuadTree implementation as a collision detection algorithm with lots of tiles.
however, it seems that there is no special _findIndex() method in the BoundNode class. This means that no matter the size of the colliding object, only the top left corner will be used to determine what objects to retrieve.
This is easily fixable by adding an extra check in the retrieve() function as well as an extra function that simply returns all the contents of a certain node. I'll upload my own fix shortly.
Hi,
Hopefully a quick (but mysterious!) problem. The following very short page works perfectly until line55 is added ("button.addChild(img);"). I have no idea why.
I have already tried renaming the variables, and creating "button1" and "button2" objects (instead of reassigning "button").
Please help. Thank you, and much appreciated!
FYI If you cannot see the code below, the page can be found at: http://bit.ly/UDZVB7
<title>EaselJS button problem</title> <script src="http://code.createjs.com/easeljs-0.5.0.min.js"></script> <script> var stage, output; function init() {
canvas = document.getElementById("tileCanvas");
stage = new createjs.Stage(canvas);
stage.mouseMoveOutside = true;
var rect, label, button;
// Create first button
button = new createjs.Container();
button.name = "button_1";
button.x = 50; button.y = 30;
button.onClick = handleClick;
rect = new createjs.Shape();
rect.name = "rectangle_1";
rect.graphics.beginFill("green").drawRoundRect(0, 0, 180, 50, 10);
label = new createjs.Text("click me (1)", "bold 18px Arial", "#FFFFFF");
label.textAlign = "center";
label.textBaseline = "middle";
label.x = 180/2; label.y = 50/2;
button.addChild(rect, label);
stage.addChild(button);
// Create second button
button = new createjs.Container();
button.name = "button_2";
button.x = 300; button.y = 30;
button.onClick = handleClick;
rect = new createjs.Shape();
rect.name = "rectangle_2";
rect.graphics.beginFill("green").drawRoundRect(0, 0, 180, 50, 10);
label = new createjs.Text("click me (2)", "bold 18px Arial", "#FFFFFF");
label.textAlign = "center";
label.textBaseline = "middle";
label.x = 180/2; label.y = 50/2;
button.addChild(rect, label);
// Add image
var img = new createjs.Bitmap("http://cdn1.sbnation.com/community_logos/9156/gangreen-small.jpg");
img.x = 5; img.y = 5;
/* Add this line to recreate problem */
// button.addChild(img);
/*************************************/
stage.addChild(button);
createjs.Ticker.addListener(stage);
stage.update();
}
function handleClick(evt) {
alert("Clicked on: " + evt.target.name);
}
</script>
Here's a jsfiddle test case for a QuadTree that is supposed to include bounds..
http://jsfiddle.net/zYMpN/2/
Notice the weird behavior (duplicates.. not really meeting described behavior) in the results.. not even sure where to being with this.
This point quad testcase, OTOH, seems to work fine:
http://jsfiddle.net/zYMpN/6/
Any thoughts/feedback would be appreciated.
Thanks
Hi,
With this code backgroundcolor is not set on IE 11 browser.
Max Depth is not propagated to children in subdivide(). When you call this._classConstructor() you should send both depth and this._maxDepth.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.