Find Jobs
Hire Freelancers

Building a Game

€8-30 EUR

Closed
Posted over 4 years ago

€8-30 EUR

Paid on delivery
We look at a square, tiled section of the Antarctic world with a fixed side length of 41. In Antarctica, the tiles are represented by a two-dimensional array of animals, with a zero value for an empty field. The world is cyclic, i.e. if an animal runs out of the world to the left, it is placed on the field furthest to the right of the corresponding line (and vice versa). The same applies to the top and bottom. The coordinate system of the world behaves in such a way that tiles with y-value 0 are at the top, and higher y-values at the bottom. Animals are instances of a subclass of the abstract class Animal. They have an alive attribute that ensures that they are drawn. Dead animals are not drawn. For each animal a method public boolean canEat(Animal animal) is already implemented in the template, which returns whether this animal can eat any other animal, according to the hierarchy shown above (arrows indicate that this species eats another animal, e.g. the whale eats penguins). However, this method still requires implementations of the following methods in each of Animal's subclasses: protected abstract boolean eatenBy(Penguin penguin); protected abstract boolean eatenBy(PlayerPenguin playerPenguin); protected abstract boolean eatenBy(Whale whale); protected abstract boolean eatenBy(LeopardSeal leopardSeal); protected abstract boolean eatenBy(Fish fish); Whereby these methods do NOT check whether the animals are on neighbouring fields, but only whether it comes according to the hierarchy to the food. Movement of animals Depending on the species, the animals have similar movement patterns. Basically, the animals have the following movement preferences: Fish: 1. above, 2. right, 3. below, 4. left All other species (Penguin, LeopardSeal, Whale): 1. left, 2. up, 3. right, 4. down First the animals check the adjacent fields in the order indicated whether there is food there. If this is the case, they move to the first such field for which the move is allowed. If you cannot move to any field with food, move to the first allowed field (also in the order given). Moves to a field with another animal that cannot be eaten by the moving animal are not allowed. Animals also never move to a field where a hunter borders in one of the four directions. If there is no allowed move for an animal, it does not move. There is also a PlayerPenguin class, which is a subclass of Penguin, but controlled by the player. Movements are made in turns, with the player always moving first and then in the following order: Whale LeopardSeal penguin fish Animals of the same species are moved in the order of their occurrence in the respective array. Eaten animals lose their lives and disappear from the tile. Dead animals no longer move. End of the game The goal of the player is to move to the field of the other penguin. The player wins the moment he moves to the square where the other penguin is. The move of the other penguin or all other animals is then no longer performed. The player loses if he moves to a field with a soul leopard or a whale. Furthermore, the player loses if the player penguin or the other penguin is eaten. Implementation of the game process Implement the method public void move() in the classes Animal and Fish. Movements (example) No results Implement the method public boolean move(int newX, int newY) in the PlayerPenguin class. Your method sets the player to the corresponding position. It also returns true if the game is over at the moment you win or lose. There is no need to check whether the player is teleporting, i.e. whether the new position is really only one step away. More Information in the Files
Project ID: 22743852

About the project

3 proposals
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
3 freelancers are bidding on average €87 EUR for this job
User Avatar
Hain, You can send me your work to me. I am ready to do your work with low cost. I love to do your work very professionally and do't think about cost. Please feel free to contact with me. Thanks Gopal
€50 EUR in 7 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I can do it but for 100, if you are interested in, send me a private message and we can discuss the details
€111 EUR in 5 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I am experienced with developing 2 dimensional games in java. This project sounds like no difficulty.
€100 EUR in 7 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of GERMANY
Munich, Germany
3.9
4
Payment method verified
Member since Nov 22, 2019

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.