How to copy a class and paste into a js.file?

Hello, I am a project in codeacademy (multi-scened games) and I am in a part “Separate files”.
I am confused trying to solve the second step.
In the first part, I had to break a code into separate files, because there are be different scenes in the project, and the corresponding files for each scene must be organised.
That’s why the first instruction was very logical:
“To include new files, in index.html ,add two <script> elements BELOW the <script> element that links to the Phaser CDN. One of the <script> will have a src attribute of “StartScene.js” and the other a src attribute of “GameScene.js” (the names of the two new blank files”

The result looks like this:

  <script src="StartScene.js">

  <script src="GameScene.js"></script>
  <script src="game.js"></script>

The second step is very confusing:
“Copy the entire code for the StartScene class from game.js and paste the code into the StartScene.js file.
Remove the code for the StartScene class from game.js.”

First of all, the instruction does not explain, what the purpose of this step is. Besides, why do I have to set one code inside of the other, when the whole idea of this section is to break the files into separate codes?
I have experimented with different combinations( like this: ). I always receive one and the same error: “Did you copy the StartScene class into the StartScene.js file?”, which does not make things clearer.
When I check the hint, it just says: “All the code for the StartScene class should ONLY be StartScene.js.”
I do not get it, because I have already written only THIS code, and nothing else.

Here is my code: (link:

<!doctype html>
<html lang="en">
    <meta charset="UTF-8" />
    <title>Bug Dodger</title>
      canvas {
        width: 450px;
  <script src=""></script>
	<!-- Add your script elements below: -->
  <script src="StartScene.js">

  <script src="GameScene.js"></script>
  <script src="game.js"></script>
1 Like

I presume that, at the moment, all the code you’ve written for this lesson exists within game.js.

The exercise seems to be wanting you to split the contents of game.js into the StartScene.js and GameScene.js files.

You’re contradicting yourself there. On the one hand, you’re asking what the point is - then swiftly following it by asking why you need to move code from one place to another, when the whole idea is to break the code into separate files…

It’s perfectly clear. There exists, presumably in game.js a class called “StartScene”. You need to copy all the code for this class to the StartScene.js file.

Not all of it. At the top of the editor pane (middle pane in the exercise) is this icon: image

If you click this, you can see all the files available in the exercise - like, perhaps, a file called StartScene.js? :slight_smile:

1 Like

I got it! This was the main problem: I did not know the icon gives me access to the rest of the codes.

1 Like