STEAM 组
game development help gamedevhelp
STEAM 组
game development help gamedevhelp
12
游戏中
77
在线
成立于
2015 年 5 月 28 日
语言
英语
所有讨论 > questions > 主题详情
Albcatmastercat 2016 年 1 月 31 日 上午 10:57
[Game Maker] Character problem
My character is healing herself every room;
The code is as follows:

spd=4
spd_jump=-9
jumping=0
image_speed=0.30
shot=0
shottime=0
right=0
left=0
crouching=0
immortal=0

global.MPMax=100
global.MP=50

global.HPMax=100
global.HP=100

Being in "Create" event, it's expected for her to reset, but how can I do as following:
I'm trying to get her to keep the variables when changing rooms, but I don't know any efficient ways to do so. Can anyone help?
< >
正在显示第 1 - 1 条,共 1 条留言
Shimmy, Shimmy, Shimmy 2016 年 3 月 5 日 上午 3:43 
Hey! It seems you are already using global variables so you don't need to initialise them every time! Do you have a controller object for your game? If not you should make one. A persistent object that is created in the first room.

Then copy the global variables from the player create event and put them in the controller object create event.

I am refering to these:

引用自 Albcatmastercat
global.MPMax=100
global.MP=50

global.HPMax=100
global.HP=100

Dont forget to take them out of the player create event otherwise it will still reset! If you have any questions just respond to this message!
< >
正在显示第 1 - 1 条,共 1 条留言
每页显示数: 1530 50

所有讨论 > questions > 主题详情