-
Notifications
You must be signed in to change notification settings - Fork 0
/
obj_answer
57 lines (40 loc) · 1.54 KB
/
obj_answer
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
Information about object: obj_answer
Sprite: spr_lrgGoodBox
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
myNumber = 0;
Step Event:
execute code:
/*switch (obj_sign.state) {
case sign_st.add: myNumber = (obj_num1.myNumber) + (obj_num2.myNumber); break;}
case sign_st.sub: myNumber = obj_num1.myNumber - obj_num2.myNumber; break;
case sign_st.mul: myNumber = obj_num1.myNumber * obj_num2.myNumber; break;
case sign_st.dev: myNumber = obj_num1.myNumber / obj_num2.myNumber; break;
}*/
if (obj_sign.state == sign_st.add) {myNumber = (obj_num1.myNumber) + (obj_num2.myNumber);}
if (obj_sign.state == sign_st.sub) {myNumber = (obj_num1.myNumber) - (obj_num2.myNumber);}
if (obj_sign.state == sign_st.mul) {myNumber = (obj_num1.myNumber) * (obj_num2.myNumber);}
if (obj_sign.state == sign_st.dev) {myNumber = (obj_num1.myNumber) / (obj_num2.myNumber);}
Draw Event:
execute code:
draw_sprite_ext( sprite_index, image_index, x, y, image_xscale, image_yscale, image_angle, c_dkgray, 0.5 );
draw_set_halign( fa_center );
draw_set_valign( fa_middle );
if (obj_sign.state == sign_st.dev && obj_num2.myNumber == 0) {
draw_text(x,y,"NaN");
} else draw_text(x,y,string(myNumber));
draw_text(x-96,y,"=")
Key Release Event for <Enter> Key:
execute code:
with (obj_num1) {instance_destroy();}
with (obj_num2) {instance_destroy();}
with (obj_sign) {instance_destroy();}
______________________________________________________