Amaldeep Prakash
Amaldeep Prakash

Reputation: 35

How can i display a sprite as a splash for some 5 seconds?

How can i display a fruit sprite when some conditions are satisfied,something like 'fruit icon x 5',it must fade of after some 5 seconds.

Upvotes: 0

Views: 134

Answers (3)

kinchan prajapati
kinchan prajapati

Reputation: 11

in cocos2dx 3.6

Sprite Name->runAction(Sequence::create(MoveTo::create(1.5,Vec2(523,450)),
    DelayTime::create(1.0),ScaleTo::create(0.1, 1.5),ScaleTo::create(0.1, 1), NULL))

Upvotes: 1

Morion
Morion

Reputation: 10860

if I understand right, you can do it with actions.

id delay = [CCDelayTime actionWithDuration: delayDuration];
id fadeOut = [CCFadeOut actionWithDuration: fadeOutDuration];
id sequence = [CCSequence actionOne: delay two: fadeOut];
[fruitSprite runAction: sequence];

Upvotes: 0

Sebastian Łuczak
Sebastian Łuczak

Reputation: 1116

You need to create seperate view controller then display it as modal view with timer. After NSTimer reaches end do dismissModalViewControllerAnimated() method to come back to first view. It's the simplest way to achieve your goal in pure Obj. C.

Upvotes: 0

Related Questions