7
7
import com .sdsmdg .kd .gameplay .controllers .MagnusController ;
8
8
import com .sdsmdg .kd .gameplay .utilities .Geometry ;
9
9
import com .sdsmdg .kd .helpers .InputHandler ;
10
+ import com .sdsmdg .kd .screens .GameScreen ;
10
11
11
12
public class Magnus {
12
13
/** CLASS MEMBERS *******************************************************/
13
14
public Vector2 magnusPosition ;
14
15
MagnusController magnusController ;
15
16
public double magnusVelocity ;
16
17
public int magnusRadius ;
18
+ public int magnusSleepTime ;
17
19
float screenWidth ;
18
20
float screenHeight ;
19
21
private RandomXS128 random ;
20
22
private Vector2 mVelocityComponent ;
21
- private boolean temp ;
23
+ public static boolean temp ;
22
24
/**--------------------------------------------------------------------**/
23
25
24
26
/** CONSTRUCTOR *********************************************************/
@@ -28,6 +30,7 @@ public Magnus() {
28
30
this .random = new RandomXS128 ();
29
31
this .magnusController = new MagnusController (this );
30
32
this .temp = false ;
33
+ this .magnusSleepTime = random .nextInt (15 ) + 15 ;
31
34
int gameWidth = 136 ;
32
35
int gameHeight = (int )((screenHeight /screenWidth ) * gameWidth );
33
36
@@ -52,23 +55,28 @@ public void prepareForSleepAndAttack(){
52
55
if (magnusPosition .x > screenWidth ) {
53
56
magnusPosition .x = screenWidth ;
54
57
mVelocityComponent .set (0 ,0 );
58
+ GameScreen .isTouched = false ;
55
59
}
56
- else if (magnusPosition .x < 0 ) {
60
+ if (magnusPosition .x < 0 ) {
57
61
magnusPosition .x = 0 ;
58
62
mVelocityComponent .set (0 ,0 );
63
+ GameScreen .isTouched = false ;
59
64
}
60
- else if (magnusPosition .y > screenHeight ) {
65
+ if (magnusPosition .y > screenHeight ) {
61
66
magnusPosition .y = screenHeight ;
62
67
mVelocityComponent .set (0 ,0 );
68
+ GameScreen .isTouched = false ;
63
69
}
64
- else if (magnusPosition .y < 0 ) {
70
+ if (magnusPosition .y < 0 ) {
65
71
magnusPosition .y = 0 ;
66
72
mVelocityComponent .set (0 ,0 );
73
+ GameScreen .isTouched = false ;
67
74
}
68
75
69
76
magnusController .destinationPoint = new Vector2 (InputHandler .touch .x ,InputHandler .touch .y );
70
77
magnusController .initialPoint = magnusPosition ;
71
78
magnusVelocity = random .nextInt (15 ) + 15 + (int )(magnusController .score / 1000 );
79
+ magnusSleepTime = random .nextInt (15 ) + 15 ;
72
80
}
73
81
}
74
82
0 commit comments