Pixi.js: how to check the position of an element

Created on 12 Dec 2016  路  6Comments  路  Source: pixijs/pixi.js

I need to write an if statement that checks the position of an element once it reaches the center of the canvas, I will add physics to that element. I have:

if red.position == 250 {console.log("this is it")}

but I get an error saying:
unexpected identifier (it doesnt like the red.position I think)

Thanks in advance!

All 6 comments

First - learn javascript. Read Flanagan book

if (red.position.x == 250) {console.log("this is it")}

Ha! That easy

UPD.

http://shop.oreilly.com/product/9780596805531.do 6th or 7th edition. Don't read all that "learn in 7 days" stuff, only hardcore!

Thanks. Just a little rusty and not used to pixi. :p

It's worth bookmarking http://pixijs.download/v4.2.3/docs/index.html for pixi docs

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

st3v0 picture st3v0  路  3Comments

lucap86 picture lucap86  路  3Comments

samueller picture samueller  路  3Comments

courtneyvigo picture courtneyvigo  路  3Comments

readygosports picture readygosports  路  3Comments