• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Stick objects together.

N

NoFontNL

Guest
I was thinking...

How would I make extendable objects?

This is what I kinda wanna create.
I thought of when dragging it up, that it creates new objects, while moving the top part up.

But how do I move this whole thing then? How do I group all those objects together? How do I move every part that is part of the full blaster?

Any ideas / help would be appreciated
Thanks in advance.
 

chamaeleon

Member
I was thinking...

How would I make extendable objects?

This is what I kinda wanna create.
I thought of when dragging it up, that it creates new objects, while moving the top part up.

But how do I move this whole thing then? How do I group all those objects together? How do I move every part that is part of the full blaster?

Any ideas / help would be appreciated
Thanks in advance.
I imagine there's no one right answer. Anything that looks good when playing the game is ok. So with that said, you could have helper instances that represent the extrusion, set an anchor instance id variable on each helper that identifies your base, and in the end step event update x and y on the helper with the appropriate offset for each based on the x and y of your anchor instance. Another option could be the have just one instance, and simply draw more sprites in the draw event to make it look bigger (which does not have any impact on the bounding box for collisions, etc., so you'd have to manage that manually). And if the extrusion is a plain color (or there would be distortions) you could in theory just do a scale of the sprite (but I don't know if only horizontal or veritical scaling growth is required for you, so it may or may not be appropriate).
 

JasonTomLee

Member
You could simply increase the object's size or it's sprite ( and use a separate variable to mimic the object's boundaries ).

I assume you'd want to click the object to move and drag it. So you'd need to do a collision check when pressing the mouse ( "mouse_check_button( mb_left )" ) and check if your cursor is colliding with the object.
A basic collision fuction you'd use is "place_meeting( x,y, object )". So you'd use that function to check if the cursor is above the specified object to follow up on whatever you'd like to do! (Drag or move object )

If you need some example code, let us know what you have so far. If you're just starting out, I'd be happy to help u out
 
N

NoFontNL

Guest
I am currently starting from scratch and I'm beginning making the editor UI. I do have some exoerience making in game editors, but didn't know how to solve this problem. I'll get back to you when I have the base system down.
 
N

NoFontNL

Guest
I'm back. Now with semi-working sizable objects! I still need some help though.

What I've done here, is I have a normal object (64x64) (1 block)
Center point is (32,64) (bottom middle)
And I have a variable called size. The image_yscale gets set to the size(so size 3 will make the image_yscale also 3)
But it collides weirdly. The bboxes are drawn with red lines.
But for some reason if the blaster is above another blaster, then the bottom blaster randomly collides with it and gets destroyed.
When placing the grabbed blaster and put it's top on the bottom part of the not grabbed blaster, then they don't collide, which they should do, right?

Any help would be appreciated
 
N

NoFontNL

Guest
Nevermind. I used collision_point_list instead of collision_point_rectangle_list
Because of the center is at (32,64) it behaved weirdly, now I use it's full collision_box instead of it's x and y coordinates
 
Top