-1

i get an error telling me theres a duplicate function in verse 38, 60 and 79. but i see no duplicates there!

verse 38 eight was the last line in this

    {
if (keyEvent.keyCode == Keyboard.RIGHT) {
    rightpressed1 = true;
    linkfacing1 = "right";
} else if (keyEvent.keyCode == Keyboard.LEFT) {
    leftpressed1 = true;
    linkfacing1 = "left";
} else if (keyEvent.keyCode == Keyboard.DOWN) {
    downpressed1 = true;
    linkfacing1 = "front";
} else if (keyEvent.keyCode == Keyboard.UP) {
    uppressed1 = true;
    linkfacing1 = "back";
}

verse 60 is the last line in

    {
    spacepressed1 = false;
}

and verse 79 is the last line in

     if (linkMc.x > 200) {
        linkMc.x -= 10
    } else if (overworldMc.x < 0) {
        overworldMc.x += 10;
    }
Glithch
  • 1
  • 2

1 Answers1

0

(1) Don't use same function names in different parts of your program.
It's not clear from your posted code whether or not you have put code on different layers, scenes or maybe even different frames. If you spread your code then be sure you did not use a duplicate function name elsewhere (later triggered by your shown code).

(2) Make sure there are no variables & functions with a matching name.

//# if a var has name like...
var myThing: int = 5;

//# then using a matching function name will cause the Duplicate Function Error
function myThing () : void
{
    //do stuff here...
}

So for example: Do you have a function spacepressed1()or such that could trigger?

(3) If still having issues, show a complete/testable minimum code required to cause your issue. Reduce your code to a few vars and functions that cause such error. After re-creating, then easier to advise...

VC.One
  • 14,790
  • 4
  • 25
  • 57
  • i started by using a tutorial to do one scene on one frame so all the code was there on one AS layer, then added a start menu before that and wanted to add another scene where hara was walking so i took all the code for walking etc and pasted it onto the new scene. but i got an error that the functions need to be different then on the second layer so i added number 1 to all the functions and that fixed it but now this one pops up. i dont understand why it wouldnt work because on the first layer it worked just fine with no duplicates. but ill add more script in the edit so you can see – Glithch May 02 '19 at 18:28
  • https://pastebin.com/4yMBTZh9 turns out i cant edit the question with the code so here is the code that i stripped a bit (wasnt sure what to strip bc i dont know whats the issue) – Glithch May 02 '19 at 18:38
  • The Pastebin code does not trigger a Duplicate Function Error for me. Is all your code in one frame (in timeline) or you used an external `.as` file to hold your code? Anyways since the first line issue is 38, I suggest you backup your program (in some folder) then edit down your current code to the first 38 lines. See if it still gives error. Also is there any code in your MClips (used as Class) that might cause this? – VC.One May 02 '19 at 20:09
  • as i said, its not in one frame because i have two frames. i have it on one layer but i have these two frames because i have two scenes so this is how i thought how it needs to be done. im in art school and this is just an assigment that was supposed to be a simple programming assigment but i got excited and did more then needed so now im having issues. – Glithch May 02 '19 at 21:06