-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpuzzleRoom
161 lines (150 loc) · 5.47 KB
/
puzzleRoom
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace CastleOfPain
{
class puzzleRoom : generalGameItem
{
//create the 4 private rect variables
private Rectangle lightRect1;
private Rectangle lightRect2;
private Rectangle lightRect3;
private Rectangle lightRect4;
//create Texture 2D for lightball
private Texture2D lightBall;
//create timer variable
int timer = 0;
//constructor
public puzzleRoom(Color puzzleColor, Rectangle aLightRect1, Rectangle aLightRect2, Rectangle aLightRect3, Rectangle aLightRect4, Texture2D aLightBall) : base(aLightBall, aLightRect1, puzzleColor)
{
//set light 1 to the contructor light 1
this.setLight1(aLightRect1);
//set light 2 to the contructor light 2
this.setLight2(aLightRect2);
//set light 3 to the contructor light 3
this.setLight3(aLightRect3);
//set light 4 to the contructor light 4
this.setLight4(aLightRect4);
this.setLightBall(aLightBall);
this.timer = 0;
}
//getter for rectangle 1
public Rectangle getLight1()
{
//returns value of the rectangle in this class
return this.lightRect1;
}
//setter for rectangle 1
public void setLight1(Rectangle someLight1)
{
//assigns the value of the rectangle to whatever the user assigns the rectangle as
this.lightRect1 = someLight1;
}
//------------------------------------------
//getter for rectangle 2
public Rectangle getLight2()
{
//returns value of the rectangle in this class
return this.lightRect2;
}
//setter for rectangle 2
public void setLight2(Rectangle someLight2)
{
//assigns the value of the rectangle to whatever the user assigns the rectangle as
this.lightRect2 = someLight2;
}
//------------------------------------------
//getter for rectangle 3
public Rectangle getLight3()
{
//returns value of the rectangle in this class
return this.lightRect3;
}
//setter for rectangle 3
public void setLight3(Rectangle someLight3)
{
//assigns the value of the rectangle to whatever the user assigns the rectangle as
this.lightRect3 = someLight3;
}
//------------------------------------------
//getter for rectangle 4
public Rectangle getLight4()
{
//returns value of the rectangle in this class
return this.lightRect4;
}
//setter for rectangle 4
public void setLight4(Rectangle someLight4)
{
//assigns the value of the rectangle to whatever the user assigns the rectangle as
this.lightRect4 = someLight4;
}
//------------------------------------------
//getter for light ball
public Texture2D getLightBall()
{
//returns value of the light ball in this class
return this.lightBall;
}
//setter for light ball
public void setLightBall(Texture2D someLightBall)
{
//assigns the value of the light ball to whatever the user assigns the rectangle as
this.lightBall = someLightBall;
}
//method to draw the lights in
public void DrawLight(SpriteBatch spriteBatch)
{
//draws all of the lightballs in their off position
spriteBatch.Draw(lightBall, lightRect1, Color.Black);
spriteBatch.Draw(lightBall, lightRect2, Color.Black);
spriteBatch.Draw(lightBall, lightRect3, Color.Black);
spriteBatch.Draw(lightBall, lightRect4, Color.Black);
}
//method to flash the lights 1 by 1
public void flash1(SpriteBatch spriteBatch)
{
timer++;
//if timer hits one second
if (timer >= 200)
{
//turn the light back off again
spriteBatch.Draw(lightBall, lightRect1, Color.White);
}
//if timer hits one second
if (timer >= 400)
{
//turn the light back off again
spriteBatch.Draw(lightBall, lightRect2, Color.White);
}
//if timer hits one second
if (timer >= 600)
{
//turn the light back off again
spriteBatch.Draw(lightBall, lightRect3, Color.White);
}
//if timer hits one second
if (timer >= 800)
{
//turn the light back off again
spriteBatch.Draw(lightBall, lightRect4, Color.White);
}
}
}
}
/* code graveyard
* if (timer > 1000)
{
spriteBatch.Draw(lightBall, lightRect1, Color.Black);
spriteBatch.Draw(lightBall, lightRect2, Color.Black);
spriteBatch.Draw(lightBall, lightRect3, Color.Black);
spriteBatch.Draw(lightBall, lightRect4, Color.Black);
}
*/