Reset a game?

I create a game where the challenge is to collect all the coins while avoiding obsticules and before the time runs out. What I try to do is when the game runs out of time or the player is dead, the player simply presses the R key on their keyboard to reset the level they play on. With my attempt to coding, I can get the game to reset and reposition all objects collection in its place, but the problem I have is that the camera following character is not given correctly. The 2nd problem I have is that the game not reset variables tables / so I can still open doors of color without having the keys or number amount of the collected parts needed.

How can I solve this problem? Is there an easier way to create a reset function? Here is my attempt to try to fix it.

= Reset game =.
stage.addEventListener (KeyboardEvent.KEY_DOWN, resetKey);


function resetKey(event:KeyboardEvent):void {}

If (event.keyCode == 82) {}

var gameSpace:MovieClip = new MovieClip();
addChild (gameSpace);
gameSpace.x =-5 * 48 + 5;
gameSpace.y =-5 * 48 + 5;

gameSpace.addEventListener (Event.ENTER_FRAME, updateGame);

var levelMask:Mask = new Mask();
addChild (levelMask);

myTimer.addEventListener (TimerEvent.TIMER, count);
myTimer.start ();

stage.addEventListener (KeyboardEvent.KEY_DOWN, kdHandler);
stage.addEventListener (KeyboardEvent.KEY_UP, kuHandler);

var North, South, East, West; to control the movement of gameSpace
North = South = is = West = false;

var hasRedKey, hasGreenKey, hasYellowKey, hasBlueKey;
hasRedKey = hasGreenKey is hasYellowKey = hasBlueKey = false;.


var levelStart: Array = new Array();
var displayMap:Array = new Array();
CDL of the var: int;
var lines: int;

chip: chip var = new Chip();

setUpLevelMap();
drawLevelMap();

Switch (levelStart) {}

EMPTY case:
case ICCHIP:
decision HINT:
case KEY_RED:
case KEY_BLUE:
case KEY_YELLOW:
case KEY_GREEN:
case DOOR_BLUE:
case DOOR_RED:
case DOOR_YELLOW:
case DOOR_GREEN:

}
}
}

all the variables with "var" inside a function body will be local to the function and will NOT change a variable named even outside the function.  That is to say, use something like:

= Reset game =.
stage.addEventListener (KeyboardEvent.KEY_DOWN, resetKey);

function resetKey(event:KeyboardEvent):void {}

If (event.keyCode == 82) {}
 
 
gameSpace = new MovieClip();
addChild (gameSpace);
gameSpace.x =-5 * 48 + 5;
gameSpace.y =-5 * 48 + 5;

gameSpace.addEventListener (Event.ENTER_FRAME, updateGame);

var levelMask:Mask = new Mask();
addChild (levelMask);

myTimer.addEventListener (TimerEvent.TIMER, count);
myTimer.start ();

stage.addEventListener (KeyboardEvent.KEY_DOWN, kdHandler);
stage.addEventListener (KeyboardEvent.KEY_UP, kuHandler);

North = South = is = West = false;

hasRedKey = hasGreenKey is hasYellowKey = hasBlueKey = false;.

levelStart = new Array();
displayMap = new Array();
cols = 0
lines = 0

chip = new Chip();

setUpLevelMap();
drawLevelMap();

Switch (levelStart) {}

EMPTY case:
case ICCHIP:
decision HINT:
case KEY_RED:
case KEY_BLUE:
case KEY_YELLOW:
case KEY_GREEN:
case DOOR_BLUE:
case DOOR_RED:
case DOOR_YELLOW:
case DOOR_GREEN:
  
  
  
   
  
}
}
}

Tags: Adobe Animate

Similar Questions

  • Reset iTunes game

    I want to reset my iTunes Macth and told me to remove all songs from within my library and make sure that I click on 'delete cloud '. If I do this, it will delete my music purchased iTunes to the cloud, so I won't be able to upload my story bought it again?

    I don't know what 'reset my Match iTunes' means exactly.  What did you accomplish?  Is that what this article calls "restart the matching process?

    Get help with iTunes game - Apple Support

  • How is it possible to reset the game Burble Place from beginner, intermediate or advanced?

    Hello

    My son likes to play instead of Burble games and has fairly well mastered the beginner... There are other levels (intermediate and advanced).  I tried to reset the level, but when he enters one of the Burble games after resetting the scores, it is always configured for beginner - I would have thought I could choose a new level as intermediate or advanced... but no option to be able to do this...

    any ideas?

    Thanks in advance...

    Laptop HP ENVY 17-j005tx, HP ENVY 27 - k001a, HP ProLiant MicroServer Gen8 G2020T, HP MediaSmart EX495 Server tilt, HP MediaVault 2020, HP ENVY 120 AiO Printer

    You must open the game first. Then you can select the game in the menu at the top, then press Options. Make sure you click OK.

  • Why am I not able to reset the game account in Itunes anylonger?

    With this last update of ITunes, I can reset is no longer play counts, as I could with a click right, or any other action that I could before. Is there a work around? Why Apple do stuff like that?

    The function Reset plays mysteriously disappeared from iTunes 12.4.0, but was restored in 12.4.1 (current version, dated 02/06/16 date).

  • How to reset many Solitaire games played and won Matches of the counters?

    How to reset many Solitaire games played and won Matches of the counters?

    Hi Keith,

    Found an answer for Vista, that should work for you in Windows 7.

    To reset the game statistics, you must delete some files. These files will be re-created automatically the next time you play the game. The files are located in the following location: 'C:\Users\[UserName]\AppData\Local\Microsoft Games\ [game]", where [username] is the name of your account and [game] is the name of the game (in your case, Solitaire). Just delete the contents of the folder, but DO NOT delete the folder itself.

    http://www.Vistax64.com/gaming/139902-Solitaire-statistics-reset.html

  • Reset do default sets a size of table to zero?

    What is the function reset 2D game table size to default to zero? Aid is not explicit on this.

    Otherwise, what is the best way to set a table 2D zero size?

    The "it takes less time to try just to post a message asking if it is": the answer is Yes. But only if the default value is an empty array to start. Obviously.

    Otherwise, what is the best way to set a table 2D zero size?

    Wire a constant empty array to your choice of a local variable or a node of 'Value' property, in view of the elimination of any potential race condition.

  • How can I get games to STOP Explorer followed my statistics?

    I don't want windows to follow my statistics, how to prevent this? Y at - it a registry key somewhere? I can't find an option.

    Hi IamlikeMike,

    Welcome to the Microsoft Answers site!

    Statistics of game in Games Explorer will make the statistics for the games you play. You cannot disable this feature. However, you have the option to either hide the statistics option by changing the display in Games Explorer, or you can reset game statistics.

    To change the display in the window of the Games Explorer, you can follow the steps below.

    (1) 1) open Games Explorer window

    (2-2) click on organize to the top left of the window

    (3-3) select from the drop-down

    (4-4) uncheck the Preview pane

    Follow the steps below to reset the game statistics.

    1. Click Start
    2. Type in the search box (Cleanmgr.exe)

    3 open the Disk Cleanup window

    4. Select the Windows drive letter (C in this case), and then click OK.

    5. in the list of files to remove, select statistics of game files

    6. click on OK.

    This clears the statistics of game files stored in the following location:

    %LocalAppData%-Microsoft-Windows-GameExplorer-GameStatistics

    Hope this information is helpful

    Concerning

    Varun j: MICROSOFT SUPPORT

    Visit our Microsoft answers feedback Forum

    http://social.answers.Microsoft.com/forums/en-us/answersfeedback/threads/ and tell us what you think and let us know what you think.

  • Does not connect WRT310N a WGA600N adapter games had worked for 2 months now?

    I have a WRT310N wireless router and connected an adapter WGA600N Wireless 2 months ago game. Both purchased and installed at the same time. Works perfectly for about 2 months. Then one night when logged in it just dropped connection. I tried to solve the problem... reset router... reset the game device wireless (including the reset total) and not luck. I thought that maybe the router went buggy I went and bought a new WRT310N. Who has not corrected the situation. Now, whenever I try to connect to the router the WGA600N will pick up the router (see the SSID) but if I update the list may disappear. I thought maybe it was signal strength, so I moved the WGA600N down next to the router (in about 5 feet). Same thing... wouldn't connect... even if the signal seems to be there all the time. I'm at a loss as to what may be the problem. I thought about doing a new WGA600N but it becomes expensive. Any ideas?

    I should add that the WGA600N connects to a WRT54GS router without problem. I also tried to connect to the router WRT310N with another PC wireless, and it wouldn't connect. Currently, I run the game through the older router device but is not what I want to do what is not my router.

    You set up your WAG600N with WRT54GS router and it worked perfectly fine. Then I think the problem lies on WRT310N router. Maybe your game adapter and computers are not connect to your wireless network. You must change some settings in your wireless router. Follow this steps on your router and I think this will make your adapter games work perfectly well.

    Open an Internet Explorer browser on your computer (desktop) wired page. In the address bar type - 192.168.1.1 and press ENTER... Let the empty user name & password use admin lowercase...

    For wireless settings, follow these steps: -.
    Click on the Wireless tab
    -Here, select manual configuration... Wireless network mode must be mixed...
    -Provide a unique name in the name box of the wireless network (SSID) in order to differentiate your network from your network of neighbors...

    -Fix the Radio band to wide - 40 MHz and change the broad Channel 9 and channel Standard 11 - 2, 462 GHz... Wireless SSID broadcast should be enabled, and then click on save settings...
    Please take note of the name of the wireless network (SSID) because it's the network identifier...
    For wireless security: -.
    Click the sub-tab under wireless > Wireless Security...
    Change the mode of WPA wireless security, encryption, select AES... Password input your desired WPA key. For example, MySecretKey, this will serve as your network key whenever you connect to your wireless network. Do NOT give this key to anyone.

    NOTE: The password must be more than 8 characters...

    Click the settings advanced wireless
    Change the interval of tag to 75 > change the Fragmentation threshold to 2304 change the RTS threshold to 2307 > click 'save settings '...
    Now let's see if you can locate your wireless network and try to connect...

  • Error undefined #1010 when you try to reset vars

    I am new to Actionscript 3 and reset the variables in a game that has several levels of difficulty.  The structure of the game is the same from one level to the other, so I want to reset the same variables each time.

    I declare variables of game in the section of the public class. The game uses a hit test on objects to trigger other functions in the game.  I use a variable to test if an object has been hit:

    public var hitResponse1:Boolean;

    If the object is touched, I put the variable to true.

    Then, in a startGameLevel function, I initialize this variable to false:

    hitResponse1 = false;

    Everything works fine in the first level, but in the second level after calling startGameLevel() to reset the game, I find that hitResponse1 rest set to true when it should have been reset to false.

    I also get an error in the output connected with these variables window:

    TypeError: Error #1010: a term is undefined and has no properties.

    So am I misunderstanding something?  I said upstairs - variables outside the functions of games.  I assumed they would be 'global' is accessible to any other part of the game. I then put their value within the functions. The startGameLevel() function must reset the value false, but it doesn't. I lose hours trying to figure this out.

    Thank you, but I think I found the problem, no doubt due to my ignorance of the best coding practices.  I had placed the variables at the end of the startGameLevel() function.  They were a hit when I need to solve a problem that came to the top in debugging.  The function makes calls to other functions, and this was happening before the script got to variables.  When I moved the variables at the top of the function, everything worked as expected.

    Thanks for the tip about debugging.  It will be a great help.

  • reset of a slide in September

    is there a way to reset a slide on the back, so you're not in the middle of an activity. I know in canvas, you can either choose and option to reset the slide (if someone uses the back or the buttons before getting back to this slide) or the slide paused.

    If you complete a slide that had a game or activity, if you press the back button to return to this slide, it is not reset the game that just, it shows you where you left it last.

    any suggestions

    I'm always reset with an advanced/shared action on Enter for a slide, where I expect to be back. When you return to the slide, it will return to the first image (not where you left), but objects that have been shown/hidden, variables that have changed the way rest which they were when you left the slide.  Have multiple examples on my blog, these situations should be taken into account when you analyze writing scripts.

    Regarding the interactions of training: they are automatically reset when you return to a slide. I don't know what you mean by "game"? If it is a custom game, you must take care of yourself the reset.

  • YouTube error, is an error occurred, please try again later. Something wrong with my profile, but what?

    My error problem is with my profile. A new profile fixes this problem.

    I can't switch to a new profile, it's just too much work to set. I just want to know what is this evil of it.

    Video did not work in safe mode, so I can say that none of the addons are contradictory. I think that some about: config pref is bad but what. You are much more experienced. Please give me a few pointers for this very frustrating problem.

    Thanks in advance.
    Kind regards.

    Hello, try to reset your game preferences personalized starting with network on the topic: config & also security.mixed_content.block_display_content turn back to false.
    I also had this problem once & could be addressed by removing the permissions.sqlite file in myprofile folder...

  • Toshiba 39l4353db has lost the smart menu function

    For the last two days I noticed that pressing the home button does not show anything more, but a white dot in the upper left corner instead of the service Cloud from Toshiba. I tried to remove the power and leave it turned off for a minute before starting again, but the problem persists.

    Does anyone else have this problem?

    Steve

    Posted by stevenlcroucher
    For the last two days I noticed that pressing the home button does not show anything more, but a white dot in the upper left corner instead of the service Cloud from Toshiba. I tried to remove the power and leave it turned off for a minute before starting again, but the problem persists.

    Does anyone else have this problem?

    Steve

    What SW version running on the set? If the latest version of 7.1.92.61.01.1, don't you RESET the game after that network update was finished?
    If this is not the case, can you please try?

  • JavaScript CSS is not BUG

    Published by Oros of formatting of the code. Please use code tags in future for better readability.

    So I have the function like this

    function notifText(x,str) {
        if(x == 0) { //advance ask
            popup(1);
            document.getElementById('roundask2').style.display = "block";
            document.getElementById('askdesc').innerHTML = str;
        } else if(x == 1) {
            popup(1);
            document.getElementById('notification').innerHTML = str;
            document.getElementById('roundnotif').style.display = "block"
        }
    }
    
    function advanceask(x) {
        idask = x;
        if(x == 0) {
            if(gameover == 1) {
                notifText(1,"Reset the Game First"); //I call this A
            } else if(gameover == 0) {
                if(solvedo == 0) {
                    notifText(0,"Solve ?"); /I call this B
                } else if(solvedo == 1) {
                    notifText(1,"Solving is on progress"); /I call this C
                }
            }
        } else if(x == 1) {
            notifText(0,"Clear All Data
    Are you sure to continue ?"); /I call this D } } popup(1) -> document.getElementById('popupback').style.display = "block"


    the problem is that for B, the popupback not to see the place (if arise, there will be a dark with 85% opacity color), but when click anywhere as the popup itself, it will appear
    NOTE: There is an event on the popupback, when you click it, it will close the popup, but when you click it (do not appear popupback)-> it works.
    He has no problem with A, C, or D-> they're fine, except the B, I tested it in the simulator of the ripple and no problem there.
    What it the most common reason, I had this problem? Thank you

    Nope, this problem already, I'm sorry that the problem is in CSS

    -webkit--> is the main problem

    Thanks for help anyway

  • How to bring back my digital version of Windows 8?

    I had Windows 8 for promotion using get for $15. Well, I recently had a problem with my computer and had to do a factory reset the game my OS back to Windows 7, which came on the PC. Is it possible to re-download the software Windows 8 on my PC? I kept a disc either and can't seem to find the email where I bought it.

    Well, you have to find the email that contains your product key.  Then, use this Web site.

  • Edge/jQuery function perimeter: need advice

    Hi all...

    I have problems with my code Adobe Edge finesse animate, and I could use some advice. I'm more than one guy edge/Flash coder, so I can't understand the scope of variables and where I can use variables and anonymous functions in the global scope.

    I wrote a game of TIC-TAC-TOE Board animate, and I hold my functions to be extended across the world so that I can just call on an action to click and read the script once the service returns a response.

    Here is a typical onclick action:

    thisSym = sym.getSymbol ("b1");

    var thisWinner = checkChoice (1, thisSym);

    the problem code

    If (thisWinner = 1) {}

    sym.getSymbol("winBox").$("theText").html ("X WINS!");

    SYM. Play (2500);

    } ElseIf (thisWinner = 2) {}

    sym.getSymbol("winBox").$("theText").html ("O WINS!");

    SYM. Play (2500);

    }

    Note that b1 is a square on the TIC-TAC-TOE grid and checkChoice is a function I wrote to complete Code to manage the control if the clicked box returns a winner.

    Currently, when I come back a winner (1 for 'X', 2 "O"), you will notice that I can go to an area specific to the timeline, dynamically updated the text to say "Gagné X" or 'O wins' depending on who wins and then sym.play(1000) (2500) to go to the main timeline.

    Here's the problem: I want to ignore the part of this click action coming after my comment //problematic code. What keeps me? The ability to control the scenario of the scene from outside the scope of the scene in the code. I can * all logical console.log and get to print all I want, but I can't step to 2500.

    Any ideas or advice? A good article about the use of personalized features on board animate would be extremely useful.

    Thank you!

    William

    Hi wmoner,

    As you've built a version by drag-and - drop 9 instances she draws from the Panel, here are 2 versions by using sym.createChildSymbol ().

    Tit mentions edge API sym.createChildSymbol () is a tool to dynamically create instances of symbols. Dynamically defined code.

    ==> TIC-TAC-TOE Board animate - copie.zip - box

    Using this method, I can:

    (1) move your TIC-TAC-TOE (code in the previous post) code in the creationComplete Panel;

    (2) I do not copy and paste 9 times the click event.

    (3) I can't reset the game of TIC-TAC-TOE, removing 9 instances with sym.deleteSymbol ().

    New code to dynamically create symbols:

    With the help of $. each() I browse table of 'plateau' to create 9 instances (or children): [a1,..., c3].

    Each instance is named 'cell' and has a click event to display winBox.

    .each $(gameBoard, {function(index,item)}

    var cell = sym.createChildSymbol ("a1", "gameboard");

    cell.getSymbolElement)

    . CSS ({"display": "inline-block", "margin": "5px", "cursor": "pointer"})

    .one ('click', function() {}

    var thisWinner = checkChoice (index, cell);

    If (thisWinner = 1) {}

    winBox var = sym.createChildSymbol ("winBox", "Stage");

    winBox.getSymbolElement () .css ({"margin": "auto", "top": "25 %"});})

    winBox.$("theText").html ("X WINS!"); }

    ElseIf (thisWinner = 2) {}

    winBox var = sym.createChildSymbol ("winBox", "Stage");

    winBox.getSymbolElement () .css ({"margin": "auto", "top": "25 %"});})

    winBox.$("theText").html ("O WINS!"); }

    });

    });

    New code to reset the game (click event):

    Console.log (' symbols of the game board: ", sym.getComposition () .getSymbols ("a1")); It returns the cells gameboard [a1,..., c3].

    .each $(sym.getComposition () .getSymbols ("a1"), function() {this.deleteSymbol ()}); It removes the cells from the game board.

    sym.getComposition () .getStage () .getVariable ("reset") (); new game board on scene. reset is created in the creationComplete help sym.setVariable ()Panel.

    sym.deleteSymbol (); It removes the current symbol: winBox.

Maybe you are looking for

  • Drive error?

    I don't seem to have the option of "Quick start" available when I open the application of the workout. Anyone have any ideas why not? Thank you very much Doug

  • Customize the text string of response from Apple Mail

    Somehow I think that I can change a file in preferences for Apple Mail that will allow me to customize the following: When I reply to an e-mail message, the following text is generated automatically: At 07:49 on May 17, 2016, Joe Blow < Joe.Blow@emai

  • Laptop HP 15: Enter the administration password in the BIOS Setup

    Hi, I have the problem to start my HP laptop when I enter the configuration of the BIOS of my laptop HP 15, it shows me to enter the administrator password. If I entered the wrong password three times on it, she showed me system turn off the message

  • Satellite A50: Cannot boot from recovery CD

    I have a toshiba satellite a50 when I try and recover back to factory settings, but my computer does not recognize the cd and it does not boot from the cd to recoverey someone help I have explored the cd there is a file with the extension .gho I real

  • Why don't the 'fn' key let me type F1, F2, etc. ?

    I have a Bluetooth wireless keyboard Apple 'Magic' with the 'fn' down key on the left. Regardless of whether or not "fn" is pressed, I always get the behavior indicated by the picture on the key. For example, if I press 'fn', then F3 at the same time