InsertA
InsertA

Reputation: 1

How would I make sure that the player has to be near a shelf to search it in my game

I have been making a game in Game maker 1.4 and can't figure out how to make it so that it is required for a player to have Collison with a specific object such as a shelf, desk, Etc. To search the items in it. I'm trying to implement a inventory system. im using the Gamemaker engine language to program this game. I have my player able to walk left and right to interact with objects. If anyone has any info about how I could check for player position/ Collison from my object please help me.

Upvotes: 0

Views: 196

Answers (1)

Steven
Steven

Reputation: 2122

You should check for collision with objects in front first, if that works well, then you can reuse that check to see if it collides with a specific object.

If you use wall objects to check collission with, then you can make an "interactable object" using the wall object as a parent.

Collision by itself is complicated though, there are many ways you can go with it. I use collision_point() myself to check if objects are colliding in front (and side/back) of the character. https://manual.yoyogames.com/GameMaker_Language/GML_Reference/Movement_And_Collisions/Collisions/collision_point.htm

But that's just the start, you may want to search up collision handling for the game you're making to handle it smoother.

Upvotes: 0

Related Questions