R
ryan821
Guest
Hi,
I am a new GameMaker user and I am trying to make a project that simulates battle system like undertake. The concept is when I hit enter, the battle begins. Three circles will pop up and fly up.
This is the code for the circle:
Create:
Alarm[0]:
And here's the code for a checkKey object:
Create:
Step:
There's also a Battle object:
Create:
The room only has the checkKey object and a circle outside the room.
The problem I am having is the circle doesn't fly up. Please help! Also, how can I improve my code?
Thanks!
I am a new GameMaker user and I am trying to make a project that simulates battle system like undertake. The concept is when I hit enter, the battle begins. Three circles will pop up and fly up.
This is the code for the circle:
Create:
Code:
flight_speed = 5;
dir = undefined;
alarm[0] = 1*room_speed;
Code:
//0=LEFT 1=RIGHT 2=UP 3=DOWN
switch (dir) {
case 0: x -= flight_speed; break;
case 1: x += flight_speed; break;
case 2: y -= flight_speed; break;
case 3: y += flight_speed; break;
}
if (y <= -10) instance_destroy();
alarm[0] = 1;
Create:
Code:
global.battle = false;
Code:
if (!global.battle && keyboard_check_pressed(vk_enter)) {
global.battle = true;
instance_create_depth(x, y, 0, obj_Battle);
}
Create:
Code:
if (global.battle) {
obj_Circle.dir = 2;
instance_create_depth(96, 550, 0, obj_Circle);
instance_create_depth(500, 620, 0, obj_Circle);
instance_create_depth(900, 400, 0, obj_Circle);
instance_destroy();
}
The problem I am having is the circle doesn't fly up. Please help! Also, how can I improve my code?
Thanks!
Attachments
-
124.1 KB Views: 9