1
votes

When you open the game, you click "Go" in the tutorial, then an image appears. When one swipes this image, if it does not go to the game over screen, the image should fly off the screen. This action can be found on line 365 and line 446.

var swipeTrueCurrentScreen = SKAction.moveToX(self.frame.size.width * 2, duration: 0.5)
currentImage.runAction(swipeTrueCurrentScreen)

A new image should then come in from the top or bottom. However, instead, the time bar at the top, as well as the background, are flying off screen, while that image is not. As you can see in the code, I tell "CurrentImage" to fly off screen and "NewImage" to drop in from the top, and I define those variables on lines 160-161.

currentScreen = screen1; currentImage = screenImage1; currentTimeBar = timeBar1
    newScreen = screen2; newImage = screenImage2; newTimeBar = timeBar2

I also switch these variables on lines 382-400, within the function that moves the image.

//here, switch the currentScreen with the newScreen so that the process can be repeated
            if newScreen == screen1 {

                newScreen = screen2
                newImage = screenImage2
                newTimeBar = timeBar2
                currentScreen = screen1
                currentImage = screenImage1
                currentTimeBar = timeBar1

            } else {

                newScreen = screen1
                newImage = screenImage1
                newTimeBar = timeBar1
                currentScreen = screen2
                currentImage = screenImage2
                currentTimeBar = timeBar2

            }

My problem is that this image is not moving, as one can see by running the code in an IOS Simulator.

I have attached the entire file of the code, and I hope that no one misuses it, as I trust the StackOverflow community. Please, this problem is on a very tight deadline and I would appreciate any attempt to assess the issue.

Thanks!

[All references to line numbers are in the GameScene.swift file.]

The code can be found at the following URL: [Zip File Link to Code][1]

EDIT: It has come to my attention that a Dropbox link is not the best way of distributing code. However, I'm afraid I'm not well versed with GitHub, so I was not able to make the conversion. I apologize.

1
You should not provide a Dropbox link. This can be SPAM, a virus, whatever. Better copy here the relevant parts of your code. Also, you are posting this link publicly, so your "trust" can be exploited...Diego Freniche
@DiegoFreniche Thank you for your input. I would very much like to allow people who would like to answer to be able to run all of the code in the IOS Simulator to see the problem. How would I post the code so people can do that?tdh
If you want everyone to see your code, create a public repo on Github and paste here the link. Doing git clone is far easier than downloading / uncompressing a zip fileDiego Freniche
Also, post here code fragments you have commented in your questionDiego Freniche
@DiegoFreniche Thank you so much! I'll have these problems solved in the next 10 minutes.tdh

1 Answers

0
votes

Looks like you're running the same action here:

//swipe word and screen
currentImage.runAction(swipeTrueCurrentScreen)
currentTimeBar.runAction(swipeTrueCurrentScreen)
currentScreen.runAction(swipeTrueCurrentScreen)

Although you are defining several actions:

var swipeTrueCurrentScreen = SKAction.moveToX(self.frame.size.width * 2, duration: 0.5)
var bringNewScreen = SKAction.moveToY(self.frame.size.height * 0.5, duration: 0.5)
var bringNewTimeBar = SKAction.moveToY(self.frame.size.height * 0.985, duration: 0.5)