• 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!

SOLVED Problems with basics

Amigo121

Member
Hello, I have just started working on my game maker project and ran across my very first problems.

Num. 1: I've created objects (with assigned sprites) and placed in my room. When I pressed the "play button" they didn't show up. I checked the "Room Editor" and it's all set to visible.
Num. 2: When you use the same object few times, is there any way to program something for specific object (not all objects)?

Thanks for any resources or help.
 
Are you using any draw events? If so, you need to use draw_self(); to get the assigned sprite to draw, as draw events otherwise disable it.

As for number 2, every instance of an object has an ID. How you access it depends on a few things, so I suggest looking through the manual on instances.
 

Xer0botXer0

Senpai
The first one sounds like a bug or something..

My viewpoint on the second question, yes there is.

If you've got x objects of obj_potato and in some code you say
obj_potato.HP = 10;

Then as you may have guessed they all get 10HP.. since they're all the same object, but they are unique.. when you create an object you create an instance of an object.

So when you work with individual objects you are dealing with an instance of obj_potato..

say you create a new object with code..

var inst = instance_create(x,y,obj_potato);

the variable inst will hold the unique identifier for that instance of obj_potato. (gms 1.4 code)

now you may think.. how else can I find the id for an instance ?

There are many functions that will provide you with that so don't stress. say you walk into a wall, and you'd like to know if that wall has an address so you can egg the walls house, you'd put something like this in your angry players step event.

if distance_to_point(obj_wall) < 1
{
var inst = instance_place(x,y,obj_wall);
}

and that silly walls instance id will be stored in the variable inst, from there you can say inst.hp -= 10; absolutely obliterating that wall!
 

Amigo121

Member
Are you using any draw events? If so, you need to use draw_self(); to get the assigned sprite to draw, as draw events otherwise disable it.

As for number 2, every instance of an object has an ID. How you access it depends on a few things, so I suggest looking through the manual on instances.
I don't use any draw event yet.
Thanks for you comment.
 

Amigo121

Member
The first one sounds like a bug or something..

My viewpoint on the second question, yes there is.

If you've got x objects of obj_potato and in some code you say
obj_potato.HP = 10;

Then as you may have guessed they all get 10HP.. since they're all the same object, but they are unique.. when you create an object you create an instance of an object.

So when you work with individual objects you are dealing with an instance of obj_potato..

say you create a new object with code..

var inst = instance_create(x,y,obj_potato);

the variable inst will hold the unique identifier for that instance of obj_potato. (gms 1.4 code)

now you may think.. how else can I find the id for an instance ?

There are many functions that will provide you with that so don't stress. say you walk into a wall, and you'd like to know if that wall has an address so you can egg the walls house, you'd put something like this in your angry players step event.

if distance_to_point(obj_wall) < 1
{
var inst = instance_place(x,y,obj_wall);
}

and that silly walls instance id will be stored in the variable inst, from there you can say inst.hp -= 10; absolutely obliterating that wall!
I heard it might be something with the run itself like I might use older version than it's recommended (not sure where I can change it tho)
Thank you for your helpful comment.
 
Top