Chris_Hawkins Posted November 25, 2014 Share Posted November 25, 2014 Hello! First time posting and I've got a question (2 actually). 1) I'm in the process of making my first game and when you reach an object, I want to launch a URL for score submission & time. Is it possible? (I think it is, just not sure how to accomplish it.) 2) I've got a timer countdown and if you run out of time before you get to colide with the end object I want a couple text boxes to come up you can click on (Try Again) & (Submit). Thanks in advance for the help!Chris Link to comment Share on other sites More sharing options...
lewster32 Posted November 25, 2014 Share Posted November 25, 2014 Just call this wherever you want and it will act as if a link was clicked:window.location.href = "http://www.url.com"; Link to comment Share on other sites More sharing options...
Chris_Hawkins Posted November 25, 2014 Author Share Posted November 25, 2014 Ok, I've got my finish object preloaded: game.load.image('finish', 'assets/finish.png'); Called as a variable var finish; Made a group and gave it physics // The Finish Line collision group finish = game.add.group(); // We will enable physics for finish image finish.enableBody = true; // Create the finish object inside of the 'finish' group var finish = finish.create(1000, 300, 'finish'); Update it to see if our dude collides with it. // Checks to see if the player overlaps with the finish image, if he does call the finish function game.physics.arcade.overlap(player, finish, gameFinish, null, this); Have it do something when they collidefunction gameFinish (player, finish) { // Removes the star from the screen finish.kill(); // Finish Game and Submit Score window.location.href = "http://URL.com";} It's in the game, just isn't removing the finish object or executing the URL. Yes, I've changed it to an actual URL. Any help on what I'm missing? Is it syntax? Thanks again. Link to comment Share on other sites More sharing options...
lewster32 Posted November 25, 2014 Share Posted November 25, 2014 This is possibly the issue: var finish = finish.create(1000, 300, 'finish');You're assigning both the sprite and the group it's in to 'finish'; it can only be one or the other. Change it to the following and see if it works: var finishSprite = finish.create(1000, 300, 'finish'); Link to comment Share on other sites More sharing options...
Chris_Hawkins Posted November 25, 2014 Author Share Posted November 25, 2014 You sir are the man! I should have noticed that subtle difference between the stars group and the star variable. singular vs plural. It's working now. Link to comment Share on other sites More sharing options...
Recommended Posts