how make the setPosition use the flash Coordinate system?


#1

Please answer these questions to help fix this issue:
What’s the issue?
use the cocos2d-x coordinate is too hard!
What’s the engine version?
all
How to reproduce it?
I want to know it!
can set the x=0,y=0 is top left??
just like flash
thank you! :stuck_out_tongue:


#2

why is it too hard?

Almost all game engine uses this coordinate system


#3

@Wuhao
but I think the 0,0 is top left , and down is y+ , right is x+ is better easy.
just like flash.
can have some function?


#4

Very simple:

  1. Get window height
  2. Subtract Y from height.
public static cocos2d::Point convertToFlashPoint( const cocos2d::Point & pPoint ) {
    const cocos2d::Size & winSize = cocos2d::Director::getInstance() -> getWinSize();
    return Point( pPoint.x, winSize.height - pPoint.y );
}

#5

@lance_gray
I know and thank you very much!:slight_smile: