Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-28-2007, 11:11 AM   #1
starburst
Registered User
 
Join Date: Mar 2007
Posts: 2
Default [AS2] Restarting a basic game

I have a basic hang man style game which records the name of the player and keeps a running score of wins and losses, but I want to implement a 'restart' which takes the back to the point where a player can enter their name (to start a 'New Game')

Im completly confused on how to do this as simply closing the game by various menthods doesnt erase the information.

Can anyone help?
starburst is offline   Reply With Quote
Old 03-28-2007, 03:40 PM   #2
mcmcom
Asleep At The Keyboard
 
mcmcom's Avatar
 
Join Date: Jun 2004
Location: Toronto, Canada
Posts: 2,528
Default

first off any variables your storing you have to set to null or blank.
then take them back to the first frame or wherever it starts
ie
ActionScript Code:
on(release){   //clear vars   _root.gotoAndPlay(1); }

Since we dont know the structure of your game or how you programmed it specifics are hard to pin down, however a good idea would be to have a frame at the beginning of your movie that actually handles all the re-setting of variables, clips, etc. Then when you want to re-set your game you can just shoot them to that frame.

(the frame can really be at the end or the beginning, as long as when its done it sends the playhead to the appropriate starting frame) Also you can label the frame something like "reset" and then just go
ActionScript Code:
on(release){  _root.gotoAndPlay("reset"); }

hth,
mcm
__________________
www.mustcodemore.com
Adobe Certified Flash 8 Developer
mcmcom is offline   Reply With Quote
Old 03-29-2007, 10:14 AM   #3
starburst
Registered User
 
Join Date: Mar 2007
Posts: 2
Default

I have got a restart 'kind of' working in my game, I have made a button with this code attached;

on (release) {
delete localinfo.data.user;
delete localinfo.data.lossScore;
delete localinfo.data.winScore;
gotoAndPlay("Scene 1", 1);
}

This dumps out all of the user data and returns the game to the first screen so you can enter a name, problem is it als displays the in game menu for the hangman game at the same time.

Can anyone give any advice?
starburst is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[AS2] coding for basic pong game Joseph Gaming and Game Development 6 02-08-2012 12:14 PM
Rate My Game, plz fill the questioner UzumakiJr Site Check 0 12-16-2006 08:48 PM
[AS2] Card Game (turn-based) - Lobby Room and Game Room, maintain state cururu Gaming and Game Development 3 05-20-2006 02:06 AM
[AS2] Anyone Got Code For Making Basic Pong Game? shongo Gaming and Game Development 0 11-25-2004 10:58 AM
basic game problems, score board, hitTest sounds, and a big one ninjacore Gaming and Game Development 3 01-03-2003 02:05 PM


All times are GMT. The time now is 10:27 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.