CodeGym
Course
Tasks
Games
Help
Subscriptions
Success stories
Chat
Forum
Articles
Users
Activity

Tasks

  • Reviews
  • About us
Start
Start learning
  • All tasks
All quests Java Syntax Java Core Java Multithreading Java Collections Games
All levels Level 0 Level 1 Level 2 Level 3 Level 4 Level 5 Level 6 Level 7 Level 8 Level 9 Level 10
Any status Available In progress Completed Closed
  • Space Invaders (Part 24/34)

    Games
    Level 0, Lesson 6
    When you release the left key or the right key, the ship does not stop moving until it hits the edge of the playing field. Let's fix that. We'll override the Game class's onKeyReleased() method. This method is called when keys are released. If the player's ship is moving, the onKeyReleased(Key) met
    3
    Locked
  • Space Invaders (Part 25/34)

    Games
    Level 0, Lesson 6
    Now we'll prepare to give the player the ability to shoot. For this, we need a fire() method that will create projectiles. We will store them in the playerBullets list. Add logic to draw projectiles in the drawScene method, and to move them — in the moveSpaceObjects method. Now all that remains is
    3
    Locked
  • Space Invaders (Part 26/34)

    Games
    Level 0, Lesson 6
    In this part of the project, we'll add the ability to shoot by pressing the spacebar. The player's newly created projectiles are added to the playerBullets list, while those that have flown off the screen are removed from it. To remove the projectiles, you can either use an iterator, or create a co
    3
    Locked
  • Space Invaders (Part 27/34)

    Games
    Level 0, Lesson 6
    Let's override the method for destroying an enemy ship. It sets the isAlive field to false and sets the destruction animation matrix. We'll also create an isVisible() method in the Ship class. It will return false after the entire animation has been displayed for a "dead" ship.
    3
    Locked
  • Space Invaders (Part 28/34)

    Games
    Level 0, Lesson 6
    At this stage, we'll add a checkHit(List bullets) method for checking whether the player's projectile has hit an enemy ship. After a hit, we need to "kill" the corresponding projectile and enemy ship. Additionally, we'll add a deleteHiddenShips() method that will remove "hidden" ships from
    3
    Locked
  • Space Invaders (Part 29/34)

    Games
    Level 0, Lesson 6
    It's time to create the enemy boss. To make him look tougher, we'll add an animation when he moves. If the animation changes with every step, it will move too quickly. To create the desired effect, you need to change the frame once every 10 steps. That's why we need to override the nextFrame method
    3
    Locked
  • Space Invaders (Part 30/34)

    Games
    Level 0, Lesson 6
    Now we'll teach the boss to shoot. Depending on the animation frame, the boss will shoot from different cannons. We'll also override the kill() method, where we'll set the value of the isAlive field and set the frames of the explosion animation.
    3
    Locked
  • Space Invaders (Part 31/34)

    Games
    Level 0, Lesson 6
    Let's make the boss animate continuously. To do this, we need to give the setAnimatedView method an isLoopAnimation parameter responsible for indicating whether the animation should loop. This parameter is used to properly set the loopAnimation field. If the loopAnimation field is true, the nextFra
    3
    Locked
  • Space Invaders (Part 32/34)

    Games
    Level 0, Lesson 6
    The game is lost not only if the player's ship is destroyed, but also if the enemy fleet reaches the player's ship. To determine the coordinates of the lower edge of the enemy fleet, we'll add a getBottomBorder() method. If all the enemies are destroyed, the player wins. For convenience, we'll add
    3
    Locked
  • Space Invaders (Part 33/34)

    Games
    Level 0, Lesson 6
    At this stage, we'll add scorekeeping to the game. The player gets 15 points for each ordinary ship and 100 points for the boss. It will be most convenient to keep score in the checkHit() method, after reworking it a little. To store the total score, we'll add a score variable in the SpaceInvadersG
    3
    Locked
  • Space Invaders (Part 34/34)

    Games
    Level 0, Lesson 6
    Congratulations! The game is done! Run it and see what happens. If you have time and motivation, you can improve the game by adding some features of your own. For example: - add other types of ships; - change the number of cannons on the ships; - add new types of projectiles; - change the scoring s
    3
    Locked
  • 1
  • ...
  • 107
  • 108
  • 109
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Game Projects
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
About
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
Follow us
Interface language
© 2021 CodeGym Programmers Are Made, Not Born
© 2021 CodeGym Programmers Are Made, Not Born