Ajuda para mudar a programação.

T

Thiago Moreira

Guest
Vendo um tutorial no youtube de como criar o jogo de nave, as naves inimigas estao spawnando muito juntas e queria que elas fossem mais separadas, mas não consigo achar no codigo de spawn das naves algo que faça elas spawnar mais separada, vou colocar o codigo pra alguem me ajudar.

if (random (100) > 90) {
instance_create_layer (random_range (sprite_get_width (spr_inimigo) , room_width-sprite_get_width(spr_inimigo)),-sprite_get_height(spr_inimigo), "instances", obj_inimigo);
}
 
K

ktiix

Guest
Hey there. We ask that you post in English here (it's in the community guidelines) even if you have to use something like Google translate first. People reading your post will likely use a translation software anyway - if you do it, it makes it more likely that you'll receive help.

The place where the objects are spawned is controlled by the x and y that you use;
random_range (sprite_get_width (spr_inimigo), room_width-sprite_get_width(spr_inimigo)) for x
and
-sprite_get_height(spr_inimigo) for y

So they are spawning just above the screen, and randomly in x. This code looks fine. How big is your room? Can you take a screenshot of them spawning bunched up? Do you set the x and y again in the create event of obj_inimigo?
 
T

Thiago Moreira

Guest
Fiz o jogo todo com base em um tutorial que vi na internet que vou deixar um link para o vídeo e fazer o arquivo do jogo;

 
Last edited by a moderator:
K

ktiix

Guest
The file you've posted is 8.5kB. It is empty. Can you try to upload it again, and verify that the file online is the same size as your project file on your computer?

That tutorial looks good. One difference I see is that you have "instances" as the layer name, instead of "Instances" - capitalization is important. But this shouldn't influence the x position when the object is created.
 

TsukaYuriko

☄️
Forum Staff
Moderator
The project file alone is not helpful. Think of it as a list of files that are related to the project as well as some settings.

That is irrelevant, though - please try to describe your problem as accurately as possible and post all relevant code. Uploading project files is to be used as a last resort.
 

TsukaYuriko

☄️
Forum Staff
Moderator
... aaand after the okay, that's, like, typically the part where you... uh, actually follow the instructions that were provided to you.


Let's try that again.

Please describe your problem clearly and in English.
 
Top