-
Notifications
You must be signed in to change notification settings - Fork 1
/
Friends.java
50 lines (48 loc) · 1.43 KB
/
Friends.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Friends here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Friends extends Actor
{
Character character;
int myCoordsX;
int myCoordsY;
int playerCoordsX;
int playerCoordsY;
int i;
public Friends(){
//setImage("images/Homework3.png");
setImage("images/karnekiundha.png");
}
/**
* Act - do whatever the Friends wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
myCoordsX = getX();
myCoordsY = getY();
playerCoordsX = MyWorld.character.getX();
playerCoordsY = MyWorld.character.getY();
//System.out.println("My Coords are: X: "+myCoordsX+" Y: "+myCoordsY);
//System.out.println("Your Coords are: X: "+playerCoordsX+" Y: "+playerCoordsY);
//giveHomework();
}
public int giveHomework(){
/* for(int n = 0; n>150;n++){
if(myCoordsX == playerCoordsX -n | myCoordsX == playerCoordsX +n){
for(int y = 0; y>150; y++){
if(myCoordsY == playerCoordsY +n | myCoordsY == playerCoordsY -n){*/
System.out.println("Hi");
// System.exit(0);
i = 1;
/* }
}
}
}*/
return i;
}
}