Master Cabalist
Member
Hi
I'm having trouble with some of my code. I was hoping that someone could see what I'm doing wrong, I'm at a wall?
Bat2 is an object on the top of the screen. There is a bunch of these Bat2, Bat3, Bat4, etc. objects. They have to be unlocked
to use, that is to drop the bat onto the play field. Inside each block is either a bat face or a greyed out bat face (hasn't been unlocked)
The greyed faces are inside the Bat2, Bat3, etc. If you have enough gems you can use your gems to unlock
one of the faces and make a new bat available.
problem:
Left clicking on the greyed faces brings up a dialogue asking if you want to unlock that bat. If you do,
a normal bat face appears, replacing the greyed face. Problem is, the unlocking isn't working. I'm clicking
on them but they don't change, its as if they aren't even there.
So, the Bats2, Bats3, Bats4 are the squares to unlock.
There is a bat object call DropBatObject that flying down to the playfield. Its created by the prior code. (DropBatObject)
Then there is the actual faces. The locked faces (BatsFaceHiddenB for example), are like this:
So in general, it works like this. the player clicks on the squares (the Bats2, Bats3, etc.). If it is greyed out that means it needs to be unlocked. So I click on the second box (with the greyed out face) and it prompts you asking if you want to buy this bat. If you do the block face becomes a bat face (not greyed out) From then on you can click on the bat face in the box and the DropBatObject flies down from the Bat Bar where the Boxes are and drops the lightning bat. (if you click on the second bat face it drops that type of bat.) I know this is quite complication but I'm at a standstill on what to do or test it.
I guess I'm just asking for second pair of eyes.
What it is doing now is just this: i click on the greyed out faces and nothing happens. But at one point while I was coding this I did have it working right. It changed the bat faces, and dropped the bat.
I'm having trouble with some of my code. I was hoping that someone could see what I'm doing wrong, I'm at a wall?
Bat2 is an object on the top of the screen. There is a bunch of these Bat2, Bat3, Bat4, etc. objects. They have to be unlocked
to use, that is to drop the bat onto the play field. Inside each block is either a bat face or a greyed out bat face (hasn't been unlocked)
The greyed faces are inside the Bat2, Bat3, etc. If you have enough gems you can use your gems to unlock
one of the faces and make a new bat available.
problem:
Left clicking on the greyed faces brings up a dialogue asking if you want to unlock that bat. If you do,
a normal bat face appears, replacing the greyed face. Problem is, the unlocking isn't working. I'm clicking
on them but they don't change, its as if they aren't even there.
So, the Bats2, Bats3, Bats4 are the squares to unlock.
GML:
if (Player.hasbatB == true)
{
if global.dropped_bat == false
{
if (position_meeting(mouse_x, mouse_y, BatsFaceB))
{
if (mouse_check_button_released(mb_left) && (global.can_click))
{
global.select_bat = 2; //the bet to drop
global.lightning_drop = true;
global.lightning_drop_myTimer = room_speed;
instance_create_depth(270, 9, -15000, DropBatObject);
audio_play_sound(PickBat, 10, false);
alarm[0] = 20;
}
}
}
}
Code:
//this is a cool down period for picking a bat
global.sentry_myTimer--;
show_debug_message("DropBatObject");
if (y > 800)
{
show_debug_message("y > 800")
with (Player)
{
//if there is a dropped bat (space for a bat to drop)
show_debug_message("dropped bat");
if (global.dropped_bat == false)
{
//dracula pointing
with (DraculaObject)
{
show_debug_message("Dracula should be DraculaPointing")
sprite_index = DraculaPointing
image_speed = 0
image_index = 2
}
with (SnowDrac)
{
sprite_index = SnowDracSendOutBats
image_speed = 0.01
global.dracula_drop_myTimer = room_speed;
}
global.dracula_myTimer = 0;
if (global.select_bat == 2)
{
show_debug_message("Creating instance of lightning bat");
global.current_bat = instance_create_depth(390, 1050, -1500, LightningBatObject);
num_lit = instance_number(global.current_bat);
show_debug_message("Number of lightning: " + string(num_lit))
with (global.current_bat)
{
show_debug_message("global.current_bat");
audio_play_sound(LightningStrike, 10, false);
if (Player.hasbatB)
{
show_debug_message("Player hasBatB");
sprite_index = LightningBatStill;
global.dropped_bat = true;
audio_play_sound(LightningBat, 10, false);
if (!global.is_anarchyMode)
{
//Player.hasbatB = false;
Player.myTimerbatB = true;
show_debug_message("Player has myTimerBatB + " + string( Player.myTimerbatB));
show_debug_message("PLayer has hasbatB: " + string(Player.hasbatB));
global.bhourglass = instance_create_depth(Bats2.x, Bats2.y, -1100, myTimerHourglassObject);
global.batBmyTimer = 0;
global.batBcountdodwn = room_speed*50;
}
else
{
Player.hasbatB = true;
Player.myTimerbatB = false;
show_debug_message("Player has myTimerBatB + " + string( Player.myTimerbatB));
show_debug_message("PLayer has hasbatB: " + string(Player.hasbatB));
//global.bhourglass = instance_create_depth(Bats2.x, Bats2.y, -10000, myTimerHourglassObject);
//global.batBmyTimer = 0;
//global.batBcountdodwn = room_speed*50;
}
}
}
}
Code:
draw_self()
/// @description Insert description here
// You can write your code in this editor
draw_text_ext_transformed_color(400, 300, "Do you wish to unleash this bat?", 30, 100, 5, 5, 0, c_red, c_red, c_red, c_red, 1)
draw_text_ext_transformed_color(400, 400, "Yes??", 30, 100, 5, 5, 0, c_red, c_red, c_red, c_red, 1)
draw_text_ext_transformed_color(400, 500, "No!", 30, 100, 5, 5, 0, c_red, c_red, c_red, c_red, 1)
//ALL THIS IS THE CASE OF UNLOCKING THE BATS
if mouse_check_button_released(mb_left)
{
show_debug_message("button check clear")
//if (mouse_x > 400 && mouse_x < 800)
//{
show_debug_message("x coordinates clear")
//if (mouse_y > 300 && mouse_y <= 600)
//{
show_debug_message("y coordinates clear")
//
//
inst = instance_create_depth(300,400, -1000, BatsFaceB)
Player.hasbatB = true
show_debug_message("Creating Bats Face B")
BatsFaceB.visible = true
instance_destroy()
//with (BatsFaceHiddenB)
//{
// visible = false;
//}
//}
}
//No
if mouse_check_button_released(mb_left)
{
if (mouse_x > 400 && mouse_x < 800)
{
if (mouse_y > 600 && mouse_y <= 800)
{
with (Player)
{
hasbatB = true
instance_create_depth(300,40, -2100, BatsFaceB)
//draw_sprite(LightningBatFace, 0, x, y-10);
}
}
}
}
I guess I'm just asking for second pair of eyes.
What it is doing now is just this: i click on the greyed out faces and nothing happens. But at one point while I was coding this I did have it working right. It changed the bat faces, and dropped the bat.