A
AFD456
Guest
Hello everyone,
I'm trying to recreate Guess the Logo game(more precisely part of it so far) https://play.google.com/store/apps/details?id=com.msi.logogame.
So I create 4 instances (of object oABC which contains letters - 1 letter = 1 instance) at the start of the game. When I click on one of them it moves to different position. I want to be able to move it to original position If I click on it for the second time.
Here is my (simplified) code:
oABC_Create:
abc_id = ds_list_create()
abc_x = ds_list_create()
abc_y = ds_list_create()
oABC_Left_Pressed:
if condition....//click on it for the first time
{
x = new position....
y = new position....
ds_list_add(abc_x,x)
ds_list_add(abc_y,y)
ds_list_add(abc_id,id)
}
else if condition.... //if I click on it for the second time
{
//I try to compare id of the instance I clicked on for second time with every id stored in abc_id data structure
//and if it matches, the code finds original x and y (temp_x,temp_y) values of the instance and write them to //x and y;
for(var i=0;i<4;i++)
{
temp_id = ds_list_find_value(abc_id,i)
temp_x = ds_list_find_value(abc_x,i)
temp_y = ds_list_find_value(abc_y,i)
if temp_id == id
{
x = temp_x
y = temp_y
exit
}
}
I hope I made myself clear.
Thank you for your time and answers! Have a nice day.
I'm trying to recreate Guess the Logo game(more precisely part of it so far) https://play.google.com/store/apps/details?id=com.msi.logogame.
So I create 4 instances (of object oABC which contains letters - 1 letter = 1 instance) at the start of the game. When I click on one of them it moves to different position. I want to be able to move it to original position If I click on it for the second time.
Here is my (simplified) code:
oABC_Create:
abc_id = ds_list_create()
abc_x = ds_list_create()
abc_y = ds_list_create()
oABC_Left_Pressed:
if condition....//click on it for the first time
{
x = new position....
y = new position....
ds_list_add(abc_x,x)
ds_list_add(abc_y,y)
ds_list_add(abc_id,id)
}
else if condition.... //if I click on it for the second time
{
//I try to compare id of the instance I clicked on for second time with every id stored in abc_id data structure
//and if it matches, the code finds original x and y (temp_x,temp_y) values of the instance and write them to //x and y;
for(var i=0;i<4;i++)
{
temp_id = ds_list_find_value(abc_id,i)
temp_x = ds_list_find_value(abc_x,i)
temp_y = ds_list_find_value(abc_y,i)
if temp_id == id
{
x = temp_x
y = temp_y
exit
}
}
I hope I made myself clear.
Thank you for your time and answers! Have a nice day.