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

GML Visual Space Rocks - DnD / Bullet does not appear on screen. ( video https://www.youtube.com/watch?v=LbMpNX1hamg )

E

Earis

Guest
Hello !

I have watched the above video and followed all the tutorials on the yoyogames chanel, on youtube , up to that point.
However after finishing it the bullet does not appear.
Backtracked, rewatched several times, changed and restored many variables in the game but noting.

Any suggestions on how it might work or what is missing ?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Without seeing your code, there's not a lot we can do other than guess, so please post the relevant code that's supposed to create the bullet. (Since this is DnD, a screenshot of it will do. Please also provide information about which event and object every code snippet you post is in.)
 
E

Earis

Guest
Thank you Tsuka Yuriko ~!


The object is named obj_red_bullet.
Three events as shown in the picture General Overview.
At the event Step the Function Call is set to obj_camera.
At the Collision event the Call User Event is set to Other.

Is the Script the Assign Variable applies/set to newBullet.
At the obj_faction there are no events as seen in the pic

Let me know if more info are needed.
Looking forward to a solution
 

Attachments

Slyddar

Member
To be honest, it's hard to tell what the problem is from those screenshots alone. I prefer to right click on the code and go to live preview, and then post that code for people to help with. I do DnD tutorials, and that's normally how I ask to see it (see my platformer below). Before you made the faction changes, did the bullets appear?

What I did notice though was after you create the newBullet in script 2nd part, you then try and assign some variables to it in script 3rd part, but you should be using newBullet.direction and newBullet.speed, etc as you are wanting to set a variable in the newly created "newBullet" bullet instance you created in the codeblock above, otherwise you are setting them in the instance that is calling the script instead. Not sure if that's the problem though, but it's one thing.

Another thing is in the first picture, in the first codeblock, you are checking other.id in the collision event, but that probably should be just other as well. In saying that, I guess you've changed it because the youtube comments say it's needed in 2.3. Without seeing the whole picture, it's hard to know.

Looking at that tutorial, I'm surprised it's aimed at beginners. She zips around pretty fast and makes quick changes, it's possible you've missed something somewhere else.
 
Last edited:
E

Earis

Guest
Thank you very much Slyddar.

I have included the respective code for DnD.
Hope it helps in finding a solution !


----Script DnD live preview code for create_bullet.----

Code:
// If Variable
if(room == rm_game1)
{
    // Declare Temp
    var dir  = argument[0];
    var spd = argument[1];
    var fac = faction;
    var col = image_blend;
    var creator_id = id;

    // Play Audio
    audio_play_sound(s_weapon, 0, 0);

    // Create Instance
    var newBullet = instance_create_layer(x + 0, y + 0, "Instances", obj_red_bullet);

    // Assign Variable
    with(newBullet) {
    direction = dir;
    speed = spd;
    image_blend = col;
    creator = creator_id;
    
    }
}

----Create event for obj_red_bullet code.----

Code:
// Assign Variable
speed = 10;

// Assign Variable
faction = undefined;
creator = undefined;
---- Step event code ----

Code:
// Declare Temp
var xx = x;
var yy = y;

// Function Call
with(obj_camera1) {
    var bulletWithinCamera = point_in_rectangle(xx, yy, camerax, cameray, camerax+cameraWidth, cameray+cameraHeight);
}

// If Variable
if(!(bulletWithinCamera == true))
{
    // Destroy Instance
    instance_destroy();
}
----- Collision Event -----

Code:
// If Variable
if(!(other.id == creator))
{
    // Destroy Instance
    instance_destroy();

    // If Variable
    if(!(other == faction))
    {
        // Call User Event
        with(other) {
        event_user(1);
        }
    }
}
 

Slyddar

Member
In the first section,
Code:
   // Assign Variable
    with(newBullet) {
    direction = dir;
    speed = spd;
    image_blend = col;
    creator = creator_id;
you set a temp variable, var fac = faction, but never pass it to the bullet like you do with the rest above. Probably should do that.

So to clarify what you want, you have a working bullet from the tutorial, but you are wanting to create another red bullet instance that only interacts with a certain faction?
 
E

Earis

Guest
Thank you.
I tried it but nothing. The problem is that the bullet does not appear at all on the scree !
Everything works ( collision, sound etc.) but the bullet does not appear.
 
E

Earis

Guest
Thank you FrostyCat.
I followed the instructions and also red the article about the updates. Still nothing.
No bullet on the screen
 
Top