Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2748

How to get position of sprite on visible rect

$
0
0

@doxes wrote:

Suppose I have sprite and i set its position randomly, how can determine sprite is visible on screen or not and if visible get relative location on screen.

I am asking this to make mario style follow.
Follower shouldn’t follow sprite when its on screen center-200 between screen center+200

I tried Follow::createWithOffset looks like doesnt work intended or I missing something.

for example
Follow::createWithOffset(sprite3, 200, 0, Rect(0,-3200, 4000, 800));

this works intended follows sprite at xOffset 200, if I only move player right to left its still follow player at same xOffset 200 point.

any suggestion about usage of createWithOffset?
thank you

Posts: 11

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2748

Trending Articles