• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 HTML 5 - the object suddenly disappears

O

OneOnline

Guest
Hello. Here is my website:
http://libertyplay.online/
If you click on the cell next to the player, the following script will start working:
Code:
var ii, jj, PL = MapEID[X,Y], FL, FLEID, Ind, Min, OldShadowsList = ds_list_create();
ds_list_copy(OldShadowsList, ShadowsList);
ds_list_clear(ShadowsList);

// Влево
Min = 0;
for(ii=0; ii < 6; ii++)
    {
    if X-ii = 0 break;
    FL = MapEID[X-ii,Y];
    if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
        {
        FLEID = GlobalFloorEID[X-ii,Y];
        ds_list_add(ShadowsList,FLEID);
        Ind = ds_list_find_index(OldShadowsList,FLEID);
        if Ind != -1 ds_list_delete(OldShadowsList,Ind);
        instance_destroy(FLEID.ShadowEID);
        }
    if ii > 1 Min++;
    // Вверх
    for(jj=1; jj < 6-Min; jj++)
        {
        if Y-jj = 0 break;
        FL = MapEID[X-ii,Y-jj];
        if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
            {
            FLEID = GlobalFloorEID[X-ii,Y-jj];
            ds_list_add(ShadowsList,FLEID);
            Ind = ds_list_find_index(OldShadowsList,FLEID);
            if Ind != -1 ds_list_delete(OldShadowsList,Ind);
            instance_destroy(FLEID.ShadowEID);
            }
        }
    // Вниз
    for(jj=1; jj < 6-Min; jj++)
        {
        if Y+jj = MapSizeY break;
        FL = MapEID[X-ii,Y+jj];
        if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
            {
            FLEID = GlobalFloorEID[X-ii,Y+jj];
            ds_list_add(ShadowsList,FLEID);
            Ind = ds_list_find_index(OldShadowsList,FLEID);
            if Ind != -1 ds_list_delete(OldShadowsList,Ind);
            instance_destroy(FLEID.ShadowEID);
            }
        }
    }

// Вправо
Min = 0;
for(ii=1; ii < 6; ii++)
    {
    if X+ii = MapSizeX break;
    FL = MapEID[X+ii,Y];
    if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
        {
        FLEID = GlobalFloorEID[X+ii,Y];
        ds_list_add(ShadowsList,FLEID);
        Ind = ds_list_find_index(OldShadowsList,FLEID);
        if Ind != -1 ds_list_delete(OldShadowsList,Ind);
        instance_destroy(FLEID.ShadowEID);
        }
    if ii > 1 Min++;
    // Вверх
    for(jj=1; jj < 6-Min; jj++)
        {
        if Y-jj = 0 break;
        FL = MapEID[X+ii,Y-jj];
        if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
            {
            FLEID = GlobalFloorEID[X+ii,Y-jj];
            ds_list_add(ShadowsList,FLEID);
            Ind = ds_list_find_index(OldShadowsList,FLEID);
            if Ind != -1 ds_list_delete(OldShadowsList,Ind);
            instance_destroy(FLEID.ShadowEID);
            }
        }
    // Вниз
    for(jj=1; jj < 6-Min; jj++)
        {
        if Y+jj = MapSizeY break;
        FL = MapEID[X+ii,Y+jj];
        if !collision_line(PL.x,PL.y,FL.x,FL.y,o_Map_Blocked,true,false)
            {
            FLEID = GlobalFloorEID[X+ii,Y+jj];
            ds_list_add(ShadowsList,FLEID);
            Ind = ds_list_find_index(OldShadowsList,FLEID);
            if Ind != -1 ds_list_delete(OldShadowsList,Ind);
            instance_destroy(FLEID.ShadowEID);
            }
        }
    }

for(ii = 0; ii < ds_list_size(OldShadowsList); ii++)
    {
    FLEID = OldShadowsList[| ii];
    FLEID.ShadowEID = instance_create_depth(FLEID.x,FLEID.y,FLEID.depth-1,o_Floor_Shadow);
    }

ds_list_destroy(OldShadowsList);
After that you will see the message "ok!" (the script is executed, but the hero still exists) and
after which the hero disappears. But on Windows everything works fine. If I remove this script, the hero will not disappear. But the script seems to have no errors. Is this a bug?

Windows game (download link)

 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Given an opportunity, I'm going to guess that instance_destroy(instance_id) variant was forgotten for HTML5, and therefore the player instance briefly destroys itself. Try wrapping that in a script that does `with (argument0) instance_destroy();` instead.
 

rwkay

YoYo Games Staff
YYG Staff
OOO... Mr Yellow you may be correct.... And checking the code... you are correct I will fix that today.

Russell
 
Top