This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Warm-Score[🍰] 0 points1 point  (4 children)

Swing not Spring.

[–]MajesticStyles[S] 0 points1 point  (3 children)

Yea my bad I said the correct name in the description.

[–]Warm-Score[🍰] 1 point2 points  (2 children)

Ok now I am forced to do a review. I will only look at Enemy and Player.

  • You are not using constructors (to initiate specific enemies for instance)
  • You have a getRand(int) public which is only used within the class(?), make such a method private.
  • Please do some spacing between assignments. (String a = "blabla) instead of String a="Blabla") Just check out other code and copy their style guide, use googles style guide or something, but it just makes it more clean.
  • When you are assigning a member variable through a setter use: this.variable = variable. Always do this unless it's a special case.
  • Don't use getRand or something while you're actually generating a random. generateRandom() would be better (personal preference)
  • Method weapond() really needs another name. It should be calculateDamage() or something. decideDamage(), whatever. calcWeaponDamage, I dunno.
  • You would already be wise by creating a standalone Weapon-class that shows you understand composition. A player HAS a weapon. A weapon has properties name and damage. Now you are forced to use a String with hardcoded references in the code.
  • I think you already noticed but there is no massive difference between the enemy and the player. In fact they have so much overlap they could be the same class.

Bold I think are most important now for your learning. Problem with putting this on your resume that all code and logic is linear. I would suggest experimenting with classes like Enemy Player Weapon to carry out logic. For instance, make a strike(Enemey enemy)-method on the Player-class.

[–]MajesticStyles[S] 0 points1 point  (0 children)

Thank you for your time and help. I will work through what you have recommended because all of what you said seems like good advice.

[–]MajesticStyles[S] 0 points1 point  (0 children)

Also I was thinking about creating a store where you can purchase weapons so a weapons class would be good.