-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstruction.cpp
59 lines (51 loc) · 1.49 KB
/
instruction.cpp
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
#include "instruction.h"
/*
when: This function just returns the number of milliseconds after the start this event occurs at
*/
int Instruction::when() {
return At;
}
/*
SetInstruction: This is a constructor for the Setinstruction class
This creates a set instruction with the given parameters.
target: This is the sprite the instruction is executed on.
When: This is the time the instruction occurs at.
Values: This is a map of the different paraeters and their values.
*/
SetInstruction::SetInstruction (Sprite* target,int When, std::map<PARAM_MAP>* Values){
Target=target;
Parameters = Values;
At=When;
return;
}
/*
perform: This function makes the changes it was set to make.
*/
void SetInstruction::perform () {
//Do it!
Target->setParameters(Parameters);
return;
}
/*
ChangeInstruction: This is a constructor for the ChangeInstruction class
This creates a change instruction with the given parameters.
target: This is the sprite the instruction is executed on.
When: This is the time the instruction occurs at.
Values: This is a map of the different paraeters and their values.
Length: This is the amount of time the instructions should take
*/
ChangeInstruction::ChangeInstruction (Sprite* target,int When, std::map<PARAM_MAP>* Values,int Length){
Target=target;
Parameters = Values;
At=When;
Duration=Length;
return;
}
/*
perform: This function makes the changes it was set to make
*/
void ChangeInstruction::perform() {
//Do it!
Target->changeParameters(Parameters,Duration);
return;
}