0 Replies - 331 Views - Last Post: 24 November 2014 - 03:43 AM Rate Topic: -----

#1 lulumars1   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 09-September 14

WoW game code help

Posted 24 November 2014 - 03:43 AM

I'm having some trouble with my World of Warcraft game I'm creating and in need of some urgent and great help! I'm mainly having trouble with my Move methods in my Player and Mage classes. Here are the methods that I have for both of the classes:

Player class:
public void Move(int locX, int locY)
	{
		locX = locX + 1;
		locY = locY + 1;
	}


Mage class:
public int Move()
	{
		Random rand = new Random();
		locX = (rand.nextInt(10)+1) + locX;
		locY = (rand.nextInt(10)+1) + locY;
		
		if (Math.random() <= .1)
		{
			health = health - 10;
		}
		else
			return health;
		
		int kills = 0;
		if (Math.random() <= .125)
		{
			kills++;
		}
		else
			return kills;
	}


In the Mage Move method, I am supposed to add a random number (1 to 10) to the x location, add a random number (1 to 10) to the y location, 1 in 10 chance it will lose 10 health points, and 1 in 8 chance it will kill something. I'm not really sure if what I have is correct (especially with the chance stuff) and I'm also unsure of what type my method should be. Also, should I be calling my superclass' (Player) move method for the Mage class? Thanks for any help in advance!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1