Giter VIP home page Giter VIP logo

tank_battalion's People

Contributors

arampetiet avatar dreojs-nl avatar martprenger avatar max2032 avatar richelbilderbeek avatar rijkvp avatar robkruger avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tank_battalion's Issues

Draw the number of opponents

In the screenshot below, there are 20 opponents left :

  • Add a variable to keep track of the opponents left. Call it opponents_left
  • Show the number of opponents left as blue tanks. Do something with for loops
  • Test out your code by assinging different values to the opponents_left variables

Load grid from file

Currently the gird consists just of some randomly generated nodes. To create & load levels the grid needs to be able to be loaded from a text file.

Create a testing level file in the folder call & place it it in: assets/levels/maze.ini

Every line of the file should correspond to one row in the grid.
A number indicates what kind of node the text represents.

For now the file should be read in the constructor of the grid class.

Draw tank

Draw the tank in the center of the screen

Enemies should die if they are hit

If an enemy get's hit by a player's shell, it should die.

- [ ] Create a variable (for example boolean shot_by_player) to know the difference between a shell shot by a player and one by an enemy

  • Implement collision detection between a shell (with shot_by_player = true) and an enemy
  • Set is_dead to true

- [ ] Remove the enemy (Don't forget it's collider) from the game

Enemies shouldn't spawn in a brick.

Currently, enemies spawn on a random x position in the grid on the top layer. This x position can be inside a brick.
This shouldn't be possible.

When spawning an enemy, check if the enemy collides with a brick. If it does, give it a new x value, and check again. Do this until it doesn't collide anymore. (Use a loop for this)

Create the Shell class

Currently the players & enemies can't fire yet. To make them able to fire we need a Shell class wich represents the shells the tanks are able to fire.

  • Create a new class called 'Shell' & place it in a new processing tab
  • The class should have a x & y variable witch hold the position of the shell
  • Create a constructor with the x & y coordinate of the shell
  • Create a draw function witch draws the shell sprite

Collision detection

  • Create a function in the grid class that transforms screen coords in to grid nodes. The opposite of what is done when drawing the nodes.
  • Create a function that gets the adjacent grid nodes of the player
  • Create a separate tab in processing that contains the collision detection functionality
  • Stop the movement of the player when colliding with a wall
  • Prevent the player from moving into walls

Add score pop ups when an enemy is killed.

According to the wiki the score you gain from killing an enemy is random between 30 and 1600 (Although it looks like it's only round numbers, maybe the person doing this issue could further investigate how exactly the score is determined?)

This score is currently added to the total score but there should be a short pop up showing how much points you gained in the place where the enemy got destroyed. Add this

Implement Collision detection between Player & Enemies

Currently the player & enemies don't collide witch each other. To implement this in a good way that also fits the collision detection for the shells I thinks we need to create a hashmap system I used in the Physics system last year.

Create a global hashmap variable in collision detection tab called colliders that stores the players & enemies by id and AABB.
If a player or enemy gets updated the corresponding AABB should be updated as well.

PS: If you know a better approach please let me now. If used this system before and out of experience i know it just works.

The enemies should fire

#42 is finished, the player is able to fire.
Now make sure the enemies can fire back too!

  • Add a timer system fire_timer/fire_delay just like the rotate_timer/rotate_delay
  • When the timer goes off spawn a new shell in the direction the enemy is facing.

Place code that renders highscore in a method

Currently the high score is rendered by code you wrote. Great job!

Instead of placing that code in the draw() method I think it deserves a method. I think that makes the code a bit more readable?

Enemy spawning

Every round of the game enemies gets spawned after some amount of time.

Create a countdown timer system that counts down a few seconds. The amount of time should be random between two constants. When the timer goes of an enemy should be spawned at the top of the arena. Note that the enemies shouldn't move yet. We will implement that later.

The player tank should fire

Currently we have a shell class that doesn't do anything yet.
Implement the shell class, the player tank should fire:

  • Create an ArrayList<Shell> called shells in the GameState
  • Pass the shells to the player's update method
  • If the space key gets pressed a new shell should be added to the shells (use the input & set some variable)
  • Create some direction variable(s) on the shell class and add it to the constructor
  • Update the position of the shell in a function called update() on the shell class
  • Of course, the shells should be updated & drawn every frame

Keep the implementation as simple as possible we will add more advanced combat features later

Create grid system

Create a grid class that has a two dimensional array of unsigned integers that indicate what type of nodes they are. For now 0 is just nothing and 1 is a brick node. The class should also have a draw function that draws the grid.
In the main class the grid should just be created & the draw function should be called.

Create a Player class

Create a new class in a separate file called Player
The class should contain the following things:

  • Two variables called x & y for the position
  • The image of the tank sprite
  • A draw function to draw the tank sprite
  • An update function. The up arrow key should move the player up.

Not present next Thursday

As a precaution I will not be present next Thursday. Currently I am in Greece where part of the country is marked code orange. The part In am visiting is still code yellow, but I'd rather be safe than sorry. I will be back on september 24.

Draw the round

In the screenshot below, the player is at a certain level, called the round:

  • Add a variable to keep track of the round. Call it round
  • Show the round
  • Use . to decrease the round in steps of 1, if the round is above 1
  • Use / to increase the round, if the round is less then 99

Create tank type enum

Currently we have two types of enemy thank: normal & rainbow. But there are more types than just normal and rainbow. To represent multiple types we need a tank type:

  • Create a new enum in the Enemy tab called TankType. It should have 3 values: NORMAL, RAINBOW & RED.
  • Replace the is_rainbow variable in the enemy class and the argument in the constructor with the enemy type.
  • Make sure each tank has a 60% change of being normal, a 20% chance of being a rainbow and a 20% chance of being red.

Create Enemy class

Create an Enemy class with the following things:

  • Two position variables
  • A draw function that draws the enemy tank sprite

Then implement the class by doing the following things:

  • Create a array of enemy classes with some testing values
  • Draw them by iterating over them

A tank should be able to fire

The shell class is added, now a tank (so both players and enemies) has to be able to fire. This should be done with the spacebar for the player.

Create the Flag

Create a new class called Flag that contains the following things:

  • An x & y position variable - assigned in the constructor

  • A draw function that draws the flag sprite at the position of the flag

Add audio system

Create an AudioManager that loads sound files when they are played for the first time.
You shouldn't add sounds yet. Just add some testing sounds to test if it works and remove them afterwards.

Add health system

Currently the player & the enemies can't die yet.
Add a health system so that the tanks can take damage and eventually die:

  • Add a integer variable called health on the player/enemy classes
  • Add a boolean variable called is_dead to the player/enemy classes
  • Add a method take_damage(int damage) to the player/enemy classes. The damage should be subtracted from the tanks health. If the health is equal to or below zero is_dead should be set to true
  • Remove enemies form the ArrayList if they are dead
  • Test out the code by subtracting a random ammout of health from the enemies every frame (delta_time * (some random))

Create a rainbow tank

Sometimes, a random rainbow tank might spawn in the game. I don't know the exact odds, but they are rare.

  • Add a new boolean in the Enemy class called "rainbow"
  • Also add this to the constructor
  • In the spawn_enemies() method, add the small possibility of a tank to become a rainbow tank (like 1/20)
  • In the draw() method in the Enemy class, change the color of the enemies if they are a rainbow tank (it looks like you can do this with the tint method)

This is it for now, we will later add the feature were the player gets a superpower if they destroy the rainbow tank.

Create a basic round system

As you can see here, there are different layouts for each round.
Once #46 is done, you can create a system to load the different layout for each round.
Add placeholders

  • In the constructor of the grid class, add a new string variable called layout_file, which holds the name of the layout file to load.
  • Create a new method called on_new_round() in the game_state file
  • Add a switch statement, which returns the layout file name for each round (In this link, it shows which layout to use for each round)
  • Initialize the grid again (grid = new Grid("layout-x");), reposition the player to its starting position again and empty the enemy ArrayList
  • Spawn enemies left according to a variable
  • Add placeholders for the layouts

I think this should do the job, but maybe @Rijk-van-Putten has a better or cleaner idea of how to do this. - Yes I have (partly)

Draw the number of lives

In the screenshot below, the player has two lives left:

  • Add a variable to keep track of the number of lives. Call it n_lives
  • Show the number of lives as tanks
  • Use [ to decrease the number of lives, if there is more then one life left
  • Use ] to increase the number of lives, if there is less then three lives

Make the tank move around

Depends on #12

  • Make the tank move around using the arrow keys or WASD in the update function of the Player class. Use the x & y position variables
  • Create a direction variable & make sure to rotate the image of the tank in the direction the tank is moving.

Use background as background

Use this sprite:

Note that in the future, we will use a different sprite, as the score, number of lives and number of enemies will change during a game.

If the player get's hit, they should die

(I added the dependency label because it's better to do this after #56, or the other way around, because they're quite similar)

If the player get's hit by an enemy, it should die and the round should be restarted.

Draw the score

In the screenshot below, the player has a score:

  • Add a variable to keep track of the score. Call it score
  • Show the score
  • Use ; to decrease the score in steps of 1, if there the score is above 1
  • Use ' to increase the score, if the score is less then 999,999 (i.e. 1 million minus 1)

Create the additional layouts

As you can see here, there are 8 different layouts the map can have.
Currently we only have 1 layout.

  • Create the second layout
  • Create the third layout
  • Create the fourth layout
  • Create the fifth layout
  • Create the sixth layout
  • Create the seventh layout
  • Create the eighth layout

To create a new layout, create a new .ini file called layout-x.ini
You can look in the file layout-1.ini how to create one.

  • 0 means that there is no brick in that position
  • 1 means that there is a topleft-brick section in that position
  • 2 means that there is a topright-brick section in that position
  • 3 means that there is a bottomleft-brick section in that position
  • 4 means that there is a bottomright-brick section in that position

Create state system

Currently we handle everything in the setup() and draw() functions. As the game gets more complex I think we need some kind of state system / state machine to handle the different kinds of states.
I have coded a state system before with a state class: State.js and a state machine class: StateManager.js. Maybe we can use something similar.

Gameplay info: strongest tank

The player has two stronger versions of itself.

  • The standard tank is already in the game, it can fire one bullet
  • The stronger tank can fire two bullets and is faster

Screenshot from 2020-10-09 10-36-57

  • The strongest tank can fire three bullets and is fastest.

Screenshot from 2020-10-09 10-35-14-1

In this zipped movie, I show off the strongest version:

tank_3.zip

All three versions, however, are killed by a single shot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.