Home SKAction.sequence within and SKAction.sequence doesn't run
Reply: 0

SKAction.sequence within and SKAction.sequence doesn't run

user1232 Published in July 16, 2018, 6:46 am

I am having a bit of a problem with this code. Inside didMove I am calling SKAction.sequence which runs fine, and creates the monsters.

However I want to be able to delete these monsters and am not being able to after a period of time.

I am calling addMonster() function and within it I have an SKaction.sequence call to fade out and remove the monsters. It doesn't seem to run though....

override func didMove(to view: SKView) {

            SKAction.wait(forDuration: 5.0)

func addMonster() {

    let monster = Enemy(enemySpriteName: "triangle", name: enemyName, 
    position: CGPoint(x: background.position.x + 300 + CGFloat(enemycount), 
    y: background.position.y + 50 + CGFloat(enemycount)), zPosition: 9)
//This part doesn't seem to run ?!
    let scale = SKAction.scale(to: 0.1, duration: 2.5)
    let fade = SKAction.fadeOut(withDuration: 3.5)
    let actionMoveDone = SKAction.removeFromParent()
    monster.run(SKAction.sequence([scale, fade,  actionMoveDone]))
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.420802 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO