Game Maker Studio: How to Collect Keys, Open Doors, Switch Objects & Parent Objects.
Visit my anime and game site: http://mcanime1.wixsite.com/mcanime
GMX File: https://tinyurl.com/collectkey
Update on info: 7/29/18
To make parent object more stable, were the object around the character is not moving
at all. Use the code below, to make object follow character, but also go into the object that is following the character and be sure to click on the character in the setting that said "Parent". This will in sure that object will follow character, without moving out of place around character.
object: Events: Create, Actions: Execute code
target = character;
myspeed = 0;
length = 0;
place = 0;
object: Events: Step, Actions: Execute code
x = obj_player.x + lengthdir_x(length,place);
y = obj_player.y + lengthdir_y(length,place);
place += myspeed;
Key box holder & Key box to follow character:
Events:
Step
Actions:
if(place_meeting(x,y,your_character_parts))
{
x=your_character_parts.x;
y=your_character_parts.y;
}
Draw on screen to move along with camera view and character:
Box outline for items:
Event:
Step
Actions:
code sheet
x=view_xview[0]+1528
y=view_yview[0]+64
Events:
Draw
Actions:
code sheet
draw_sprite(sprite_index,image_index,view_xview[0]+1528,view_yview[0]+64);