我有一家商店,我试图通过调试器内部的所有帐户来设置它,但它完全没有做任何事情。
这是我的设置:
o_Shop
- 玩家互动以在 room0 内创建一个图层
o_Shop_setup
- 创建数组,创建事件:
global.inventory[1, 1] = "Mines"; //Item Name
global.inventory[1, 2] = sp_Blue_mine_UI; //Item Sprite
global.inventory[1, 3] = 50; //Cost
global.inventory[1, 4] = MINE_NUMBER; //Current Inventory
global.inventory[1, 5] = MINE_NUMBER_MAXIMUM; //Maximum amount
//HE Ammo
global.inventory[2, 1] = "HE Ammo"; //Item Name
global.inventory[2, 2] = sp_ammoHE; //Item Sprite
global.inventory[2, 3] = 5; //Cost
global.inventory[2, 4] = AMMO_AMOUNT; //Current Inventory
global.inventory[2, 5] = AMMO_AMOUNT_MAXIMUM; //Maximum amount
然后,我使用以下访问该数组的对象:
o_item_parent - o_shop_Mines/o_shop_AmmoHE 的父级 - o_item_parent 抽奖事件的内部:
draw_set_font(fnt_small);
draw_set_halign(fa_center);
draw_set_valign(fa_middle);
draw_set_color(c_white);
draw_text(x, y - 100, global.inventory[myid, 1]);
draw_sprite(global.inventory[myid, 2], 0, x, y - 30);
draw_set_color(c_yellow);
draw_text(x, y + 32, string(global.inventory[myid, 3]) + " Coins");
draw_set_color(c_white);
draw_text(x, y + 64, string(global.inventory[myid, 4]) + " / " + string(global.inventory[myid, 5]));
o_shop_Mines - 继承抽奖事件,不做任何更改。
o_shop_Mines 创建事件:
myid = 1;
o_shop_AmmoHE - 继承平局事件而不做任何更改。o_shop_AmmoHe 创建事件:
myid = 2;
o_buy_parent - o_buy_Mines/o_buy_ammoHE 的父级 o_buy_parent - 创建事件:
image_speed = 0;
image_index = 0;
o_buy_parent
步骤事件:
if (COINS >= global.inventory[myid, 3])
{
image_index = 0;
}
else
{
image_index = 1;
}
if (global.inventory[myid, 4] == global.inventory[myid, 5])
{
image_index = 1;
}
o_buy_parent
左按事件:
if (global.inventory[myid, 4] == global.inventory[myid, 5])
{
audio_play_sound(snd_gunReload, 1, false);
}
else if (COINS < global.inventory[myid, 3])
{
audio_play_sound(snd_game_over, 1, false);
}
else
{
//audio play sound snd_purchase_complete
COINS -= global.inventory[myid, 3];
global.inventory[myid,4]++;
}
o_buy_Mines
- 从 o_buy_parent 继承 Step Event/Left Pressed Event
在o_buy_Mines
创建事件内部:
myid = 1;
event_inherited();
o_buy_ammoHE
- 从 o_buy_parent 继承 Step Event/Left Pressed Event
在o_buy_ammoHE
创建事件内部:
myid = 2;
event_inherited();
在o_buy_ammoHE
创建事件内部:
myid = 2;
event_inherited();
o_buy_ammoHE
左按下事件内部:
if (global.inventory[myid, 4] == global.inventory[myid, 5])
{
audio_play_sound(snd_gunReload, 1, false);
}
else if (COINS < global.inventory[myid, 3])
{
audio_play_sound(snd_game_over, 1, false);
}
else
{
//audio play sound snd_purchase_complete
COINS -= global.inventory[myid, 3];
global.inventory[myid,4]++; //breakpoint triggers fine, does nothing.
//Have also tried the below line, doesn't work, but commented out currently:
//AMMO_AMOUNT += 5;
}
ALL CAPS 中的所有变量都是使用 o_init rm_LoadingScreen 内部的 globalvar 方法创建的全局o_init
变量is inside of room ->
rm_LoadingScreen
除了持有这个不是持久的对象之外什么都不做,这个对象包含一个可以改变的switch语句STATE = GameState
(枚举)
`STATE = GameState.menu` is called by default which calls
scr_menuLoader();
break;
除商店外,一切正常。它昨天确实有效,但我无法追踪我打破了什么。目前,代码正在增加一个在屏幕上绘制的数字
draw_text(x, y + 64, string(global.inventory[myid, 4]) + " / " + string (global.inventory[myid, 5]));
但 globalvar AMMO_AMOUNT 没有改变。调试器显示它永远不会改变。
谁能提供一些反馈或第二双眼睛?我已经盯着这个看了好几个小时了,我只是看不出有什么问题。