P
PatatjeFriet
Guest
Hello,
So i am making a game were i want to have states something like hearts of iron 4 and europa universalis 4. So i drew 2 different objects with different sprites and made a parrent object for them. What they are supposed to do is glow (i just made the image a bit yellower) when i press them. In the parent object i put a draw event to draw the 2 objects, but now when i put them in the room the draw event works only for 1. They are both in the room and you can see them, but only 1 when i click them glows. And the weird thing is if i delete 1 in the room and then place it again and i start the game it will only work for that one. So for example i put obj 1 first in the room and then obj 2. Obj 2 will glow when i press but obj 1 not. Now when i put obj2 first and then obj 1 obj 1 is going to glow. Can someone explain to me why it is not working?
Code:
Regards,
Patatjefriet
So i am making a game were i want to have states something like hearts of iron 4 and europa universalis 4. So i drew 2 different objects with different sprites and made a parrent object for them. What they are supposed to do is glow (i just made the image a bit yellower) when i press them. In the parent object i put a draw event to draw the 2 objects, but now when i put them in the room the draw event works only for 1. They are both in the room and you can see them, but only 1 when i click them glows. And the weird thing is if i delete 1 in the room and then place it again and i start the game it will only work for that one. So for example i put obj 1 first in the room and then obj 2. Obj 2 will glow when i press but obj 1 not. Now when i put obj2 first and then obj 1 obj 1 is going to glow. Can someone explain to me why it is not working?
Code:
Code:
Create event:
pro1 = 0;
pro2 = 0;
Left pressed event:
//province 1
if position_meeting(mouse_x,mouse_y,obj_1) {
if pro1 = 0 {
pro1 = 1;
pro2 = 0;
}
else {
pro1 = 0;
}
}
//provincie 2
if position_meeting(mouse_x,mouse_y,obj_2) {
if pro2 = 0 {
pro2 = 1;
pro1 = 0;
}
else {
pro2 = 0;
}
}
Draw event:
//provincie 1
//standart
with (obj_1) {
draw_sprite(spr_1,0,self.x,self.y);
}
//selected
if pro1 = 1 {
with(obj_1) {
draw_sprite(spr_1,1,self.x,self.y);
}
}
else if pro1 = 0 {
with(obj_1) {
draw_sprite(spr_1,0,self.x,self.y);
}
}
//provincie 2
//standart
with (obj_2) {
draw_sprite(spr_2,0,self.x,self.y);
}
//selected
if pro2 = 1 {
with(obj_2) {
draw_sprite(spr_2,1,self.x,self.y);
}
}
else if pro2 = 0 {
with(obj_2) {
draw_sprite(spr_2,0,self.x,self.y);
}
}
Patatjefriet
Last edited by a moderator: