Game Dev Project

I have been having trouble with understand what they are trying to ask me to do in the project ‘Electric Mouse’ in the PRO skill path create video games with phaser.js.

in step 4 it states - The images we will be using for our characters will be taken from a sprite sheet. A sprite sheet contains multiple frames, each with a different image. We can “animate” these images by playing them in quick succession to appear like a picture is moving. To animate Electric Mouse, we need to insert two more properties inside each object of the frames array. Create two more keys called start and end and set the value for each animation as followed: For instance, the first element in frames should have 3 properties:

  • key with a value of 'playerIdle' ,
  • start with a value of 0 ,
  • end with a value of 2 .

Save your code to see Electric Mouse’s idle animation.

It would be much appreciated if someone could assist me :slightly_smiling_face:

here is the link to the project; https://www.codecademy.com/paths/create-video-games-with-phaser/tracks/game-dev-learn-javascript-objects/modules/game-dev-project-objects/projects/electric-mouse

Hey there! I haven’t yet followed that course, but maybe I can still help you.
I think the exercise is asking you to add properties:
start
end
to frames of gameState.player.

  • In step 1 you review the object gameState.
  • In step 2 you modify the property player of gameState, where player is an empty object, so you just define its properties writing like so:
gameState.player = {
  name: 'Electric Mouse',
  health: 45,
  frames: []
}
  • In step 3 you create 4 elements inside the array frame. Each one of these elements is actually an object.
    frames will become like this:
frames: [
    {
      key: 'playerIdle',
    },
    {
      key: 'playerAttack',
    },
    {
      key: 'playerDefend',
    },
    {
      key: 'playerSpecial',
    },
  ]
  • Finally step 4 asks you to add two more properties below key for each element of the array frames, like so:
frames: [
    {
      key: 'playerIdle',
      start: 0,
      end: 2
    },
    {
      key: 'playerAttack',
      start: somevalue,
      end: somevalue
    },
    {
      key: 'playerDefend',
      start: somevalue,
      end: somevalue
    },
    {
      key: 'playerSpecial',
      start: somevalue,
      end: somevalue
    },
  ]

You have to find the correct values to put instead of somevalue from the table available in the instructions of step 4:

image_2021-04-14_193834

Does this solve your problem?

1 Like

yes, thank you very much this has been so helpful :slightly_smiling_face:

1 Like