Comments (2)
Heya, thank you for taking the time to open an issue!
onDotClicked
should be a function which takes two numbers, which correspond to the (x, y)
coordinates of the dot that's been clicked. The x and y values are between 0 and 23, and start from the top left corner. Updating your code to:
onDotClicked = (x, y) => {
console.log(x, y);
},
looks like it correctly prints out the coordinate of the dot that's been clicked.
Also, when you click the same dot twice in a row, nothing happens
I think console.log
is being called twice - when I tested in Chrome and Firefox both printed a number next to the log line, indicating how many times that line had been logged rather than printing it multiple times. You can see this in the gif above.
Are there any examples for onDotClicked?
At the moment, we've only got the reference documentation, but this is autogenerated from the code, and isn't particularly helpful. I'll add a comment to it saying how it should be called.
from 24a2.
Ah, got it. You'd call getDot with those coordinates to get the color of the dot. Thanks!
from 24a2.
Related Issues (14)
- Custom grid size HOT 2
- Consider dropping P5 as a dependency HOT 6
- Sharing games made with 24a2 HOT 7
- Update library file path in https://24a2.routley.io/tutorial/ HOT 1
- Feature request: custom grid size HOT 1
- Investigate mobile support HOT 2
- Feature request: set text color HOT 1
- Helter Shelter - a game based on the 24a2 engine HOT 1
- Add basic sound support HOT 1
- onDotClicked() doesn't work when the canvas has padding
- ES6 modules support HOT 4
- Configurable clear color HOT 2
- A list of featured games? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 24a2.