#A way to replace place_meeting object with a check to see if an object has a variable

13 messages · Page 1 of 1 (latest)

humble vine
#

I am following a tutorial for collision and in it they use the code place_meeting then the object that is the wall for the object, however I want to add more objects that the player will collide with other then just one, is there any way to replace the singular object with a check to see if an object has a variable to do the collision script?

I am looking from this tutorial https://www.youtube.com/watch?v=KnfQo32ME5g, and the code is

    {
    xspd = 0
    }
if place_meeting( x, y + yspd, sprTileTest)
    {
    yspd = 0
    }

and I want to replace sprTileTest with a variable check so I can add the collision script to more objects easily

Support me and these videos on Patreon! https://www.patreon.com/peytonburnham

This is a 6 part series showing you how to make an RPG, good luck! There are TWO VERSIONS of this "Part 1!" This version takes it a bit slower and is aimed at people who've pretty much never used GameMaker, or aren't very confident in navigating it. If you've looked a...

▶ Play video
west rootBOT
#

With this function you can check a position for a collision with another instance or all instances of an object using the collision mask of the instance that runs the code for the check. When you use this you are effectively asking GameMaker to move the instance to the new position, check for a collision, move back and tell you if a collision was found or not.

Arguments
x: The x position to check for instances.
y: The y position to check for instances.
obj: The object to check for instances of.

humble vine
#

I look there?

harsh slate
#

I must've linked it for a reason 😉

#

Check out the docs page.

humble vine
#

ah ok

#

thank you very much

harsh slate
#

however I want to add more objects that the player will collide with other then just one
And you should use Inheritance for this.

humble vine
#

Is there a link to how inheritance works?

humble vine
#

thank you very much

#

Update: It now works! This was way simpler then what I imagined what I would have to do lol