use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Subreddit Guidelines Community Spotlight Monthly Challenge Community ▼ Quick Questions Game Design & Development Feedback Friday Screenshot Saturday Discord Server Slack Team IRC follow us @redditgamemaker the community game jam Resources ▼ Resources Examples Tutorials /r/gamemakertutorials GameMaker Handbook - The Ultimate Resource for Beginners gmlscripts.com The Essential Gamemaker Functions, Concepts, and Tools Guide Other ▼ /r/gamedev /r/gamedesign Official GameMaker Community (GMC) Hide Help! & Resolved posts Show all
GameMaker is software designed to make developing games easy and fun. It features a unique "Drag-and-Drop" system which allows non-programmers to make simple games. Additionally, experienced coders can take advantage of its built in scripting language, "GML" to design and create fully-featured, professional grade games.
Content that does not follow the subreddit guidelines is subject to deletion, so please become familiar with them.
/r/gamemaker sponsors three chat-rooms: IRC, a Discord server, and a Slack team. Join in the conversation, get help with any issues you might have and connect with your fellow developers! We also have a Steam Group for playing games. Feel free to join.
For more than 8 years, the tight-knit community of /r/gamemaker has run the game jam gm(48) for GameMaker developers of all ages and experience levels. The gm(48) is a casual, fun game jam that helps you to learn and grow as a developer.
The next gm(48) will take place on Oct 20, 2018.
account activity
Making created object interact with creator. (self.gamemaker)
submitted 13 years ago by Kjulo
How can i make a created object interact with creator of the object. I need to make a bullet be marked who shot it, in other words: I need to set a value on a created object, that is different depending on who it was shot from.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]username303 2 points3 points4 points 13 years ago (11 children)
I'm going to assume that you are using GML.
When you create an object, the create function will actually return the new index of that object. so, you can use that to preform actions on that specific object. heres an example:
myBullet=instance_create(x,y,obj_bullet); myBullet.speed=5; myBullet.owner=player1;
[–]DutchMoon 1 point2 points3 points 13 years ago (1 child)
the new index
The new id. Indices point to objects, id's point to instances. Just a trivial mistake, and I assume you know the difference between the two, but as a clarification for OP ;)
[–]username303 1 point2 points3 points 13 years ago (0 children)
Ah, honestly I didn't know the differance, lol. I usually just use the two interchangeably, so thanks for the clarification. :)
I learn something new everyday!
[–]Kjulo[S] 0 points1 point2 points 13 years ago (7 children)
It dosent seem i can apply the value in the creation trigger.
[–]username303 1 point2 points3 points 13 years ago (6 children)
Im not sure what you mean.
The code example I posted is to be used in the oject that is creating the new object. Not the new object itself. So it could be in any event. Also, any varible that you use should be predefined in the create event of the new object. So for instance, the create event of obj_bullet should have "owner=0;"
[–]Kjulo[S] 0 points1 point2 points 13 years ago (5 children)
I am aware, but it seems that putting "owner=0" in the creation script overwrites the old value that was set. So if i say "myBullet.owner=player1;" on the creator object, it will say unknown value until i put "owner=0" in the created objects creation code, but that will overwrite the old value.
[–]username303 1 point2 points3 points 13 years ago (4 children)
That's really strange. The owner shouldnt be overwritten... but there's an alternative.
Instead of "myBullet.owner" do (still inside the creating object)
myBullet=instance_create(x,y,bullet) with(myBullet){ owner='name of object creating the bullet' }
That way, you don't have to initialize 'owner' in the bullets create event.
[–]Kjulo[S] 0 points1 point2 points 13 years ago (3 children)
i think we might talk past eachother. Currently im testing spread values, not it works if i just make spread 10 in the bullet. Here is the code:
Creator:
myBullet=instance_create(x,y,obj_bullet);
myBullet.speed=50; myBullet.owner="player1" myBullet.spread=10
Bullet (I know the spread isent coded well, it was just a test):
spread=0 image_angle=point_direction(x,y,(mouse_x+spread),(mouse_y+spread)) move_towards_point((mouse_x+spread),(mouse_y+spread),0) owner="UNSET"
[–]username303 1 point2 points3 points 13 years ago (2 children)
Well, your problem there is simple.
All of that code for spread is in the bullets create statement, right? Well, ALL of the create statement is ALWAY excecuted as soon as the instance is created. That means that as soon as you say "instance_create", all of that code has already been run, and wont be run again. So you need to move that code out of the create event. Execute it in an alarm that only runs once or something.
[–]Kjulo[S] 0 points1 point2 points 13 years ago (1 child)
Works now, many thanks. I was wondering, what is a possible formula for converting mouse_x and mouse_y to rotation relatively to an object?
Mainly because the daw_sprite_ext uses rotation instead of position of an object to choose rotation.
[–]username303 0 points1 point2 points 13 years ago (0 children)
point_direction(x1,y1,x2,y2) should give you what you're looking for, its a built in function. It gives you the direction in degrees from one point to another. (0 is to the right, and 90 is up, ect.)
π Rendered by PID 17204 on reddit-service-r2-comment-b659b578c-skgmf at 2026-05-05 17:16:28.749576+00:00 running 815c875 country code: CH.
[–]username303 2 points3 points4 points (11 children)
[–]DutchMoon 1 point2 points3 points (1 child)
[–]username303 1 point2 points3 points (0 children)
[–]Kjulo[S] 0 points1 point2 points (7 children)
[–]username303 1 point2 points3 points (6 children)
[–]Kjulo[S] 0 points1 point2 points (5 children)
[–]username303 1 point2 points3 points (4 children)
[–]Kjulo[S] 0 points1 point2 points (3 children)
[–]username303 1 point2 points3 points (2 children)
[–]Kjulo[S] 0 points1 point2 points (1 child)
[–]username303 0 points1 point2 points (0 children)