Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
(1 edit)

the 5 question is kinda hard to explain... So ill show you an example!

this string of code: bull = instance_create(x,y,o_bullet)

sets the variable "bull" to the "id" of the created instance. And you can use it like this:

turn = 0  repeat(8)  { bull = instance_create(x,y,o_bullet)  bull.direction = turn  turn += 45 }

if you write this line of code the executing object will create 8 bullets that are allways heading in 8 directions, without any spread, and each bullets direction is on 45 degrees higher than the previous one. Its preety usefull to create more complex bullet hell attacks. Also you can set any variable of the created instance, not only the direction. It was just an example. Also remember that it changes the variables after the "create" event of the created instance ends. I hope i explained everything correctly. Use it if you want because im not forcing you im just telling you. I hope its gonna be usefull for you! And thanks for answering all of the questions.

< |: 3 its you in text (your avatar).

(1 edit)

thank you, that actually helps a lot. There's still loads I don't know in GML. This can definitely be used to make more complex enemy attacks!

(Edit) That helps so much. Before I had like 50 different bullet objects hahah, I know right, but now I can cut that down to like 5, cause I can set the speed and sprite_index and so on. 

(1 edit)

Yay i helped! :D

(EDIT) So i was thinking should i say i to you or is it gonna be a bunch of useless knowledge. And i decided to say it to you because it can be usefull in the future (i have no idea if you know this or not).

So if you needed for enemies to not see trough walls you can write this stack of code:

if instance_exists(o_player)  {

if collision_line(x,y,o_player.x,o_player.y,o_wall,true,false)  {  cansee = false  }

if not collision_line(x,y,o_player.x,o_player.y,o_wall,true,false)  {  cansee = true  }  }

I hope i have written everything like it should be.

Also if you dont know how to do something you can look in the instruction or improvise! Because if it aint broke - dont fix it.