MFGG Forums
  • Home
  • Members
  • Help
  • Search
MFGG Main Site MFGG Forums MFGG Developer Discussion v
« Previous 1 … 5 6 7 8 9 … 16 Next »
Breaking Blocks in DragezeeY Engine 7
MFGG Forums MFGG Developer Discussion v
« Previous 1 … 5 6 7 8 9 … 16 Next »
Breaking Blocks in DragezeeY Engine 7
MFGG Forums MFGG Developer Discussion v
« Previous 1 … 5 6 7 8 9 … 16 Next »
Breaking Blocks in DragezeeY Engine 7
Mark All Posts Read Today's Posts

Breaking Blocks in DragezeeY Engine 7
United States Bully With a Hat
Resident Forgotten Mario Enemy
Members
Submitter Iso Collab Contributor MFGG 19th Anniversary
#1
04-28-2020, 11:12 AM
I'm trying to make it so that the brick blocks break when Mario walks into them from an angle. When I tried to do it, nothing happened!
Here's my code:
(In the obj_brickblock object)
Code:
Collision Event with object obj_mario:
execute code:

if (global.powerup == 15)
{
    alarm[0] = 2
}

Alarm Event for alarm 0:
execute code:

sound_play(snd_break);
score += 50
{
    ID = instance_create(x+8,y+8,obj_shard)
    {
        with (ID) motion_set(45,6)
        with (ID) sprite_index = spr_shard_t
    }
    ID = instance_create(x+8,y+8,obj_shard)
    {
        with (ID) motion_set(60,6)
        with (ID) sprite_index = spr_shard_t
    }
    ID = instance_create(x+8,y+8,obj_shard)
    {
        with (ID) motion_set(120,6)
        with (ID) sprite_index = spr_shard_t
    }
    ID = instance_create(x+8,y+8,obj_shard)
    {
        with (ID) motion_set(135,6)
        with (ID) sprite_index = spr_shard_t
    }
}
with (self) instance_destroy()
What do I do?

  ↳
China Hyper
Ambitious but too burnt out
Members
assholw adminy Big Help Submitter Super Reviewer Wiki Contributor Iso Collab Contributor Sprite Comp Winner (3) Sprite Comp Runner-Up (4) Sprite Comp Top 5 (2) Minigame Comp Winner (4) Minigame Comp Runner-Up (2) Music Comp Winner Music Comp Runner-Up Music Comp Top 5 Drawing Comp Winner (3) Drawing Comp Runner-Up Drawing Comp Top 5 (5) Special Comp Winner Egg Hunter (3) Skull Badge (2) E3 Bingo Game of the Month Winner (5) NCFC Contributor (4) Secret Santa (5) Holiday Tree NPGA Distinguished Service MFGG 17th Anniversary MFGG 18th Anniversary MFGG 19th Anniversary Ye Olde MFGGe Retro Game Jam Participant MFGG Awards 2010 Winner MFGG Awards 2012 Winner MFGG Awards 2013 Winner MFGG Awards 2014 Winner MFGG Awards 2015 Winner MFGG Awards 2018 Winner MFGG Awards 2019 Winner MFGG Awards 2020 Winner
#2
04-28-2020, 01:09 PM
I think this would worked out better:

Code:
Step event:
execute code:
var p_hspeed = 0;
var p_vspeed = 0;
if !(instance_exists(obj_mario))
    { exit; }
else
{
    p_hspeed = obj_mario.hspeed;
    p_vspeed = obj_mario.vspeed;
}

if (global.powerup == 15) && (collision_rectangle(bbox_left-(1+p_hspeed), bbox_top-(1+p_vspeed), bbox_right+(1-p_hspeed), bbox_bottom+(1-p_vspeed), obj_mario, 1, 1))
{
    event_user(0);
}

User Event 0 (other events):
execute code:

sound_play(snd_break);
score += 50;
{
    ID = instance_create(x+8, y+8, obj_shard)
    {
        with (ID) motion_set(45, 6);
        with (ID) sprite_index = spr_shard_t;
    }
    ID = instance_create(x+8, y+8, obj_shard);
    {
        with (ID) motion_set(60, 6);
        with (ID) sprite_index = spr_shard_t;
    }
    ID = instance_create(x+8, y+8, obj_shard);
    {
        with (ID) motion_set(120, 6);
        with (ID) sprite_index = spr_shard_t;
    }
    ID = instance_create(x+8, y+8, obj_shard);
    {
        with (ID) motion_set(135, 6);
        with (ID) sprite_index = spr_shard_t;
    }
}
with (self) instance_destroy();

Explainations:
- Since the brick object is already classified as a solid object. This prevent obj_mario overlap the mask for the brick object. In order to remedy this, collision_rectangle is an extended version of object collision event with far more flexibility. I added the value of 1 plus player's movement speed to have a more accurate collision.
- For an instant trigger event, alarms are not really good with that. Event user is something that's far more useful if you want to activate something instantly.

I wrote the script on my phone so I can't be 100% sure if it works. But under my knowledge it should worked better than it is before. Also, I'm not too sure what do you mean by walk from an angle, it would be easier for me to work on if it has more details about it.
[Image: Hyper86-Camry.png]

Main Site | YouTube | Bluesky | My OC


  ↳
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
Forum Jump:

Mario Fan Games Galaxy - Powered by MyBB | MFGG Staff | Contact Us

Linear Mode
Threaded Mode