GML Drawing from within a Script

E

Ephemeral

Guest
In my draw event, I have
Code:
draw_custom(x, y, etc.);
draw_circle(x, y, r, false);
the draw_custom script has
Code:
draw_circle(etc.)
The non-script circle shows up. The script circle doesn't. What gives? Can we not draw with scripts anymore?
 
There's a lot of reasons why it may be failing. You'll need to provide the details. If I had to guess I'd say you are mistakenly drawing in the wrong place. Or maybe your variables aren't what you exepct them to be, for example, make sure you aren't accidentally using strings instead of real numbers.
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
Is the circle that is being drawn directly in the event fully overlapping the circle that is being drawn in the script, by any chance? Without seeing the real code, we can only guess. Therefore, please post all relevant code.
 
E

Ephemeral

Guest
That is the real code. I already made a simplified-as-possible version of what I was doing when I noticed this to rule out problems in my own code as the cause.

Code:
/// Draw Event

draw_circle(x - 256, y, 128, false);
draw_custom();
Code:
/// draw_custom()

draw_circle(x + 256, y, 128, false);
This is in a blank room in a newly created project, with only the one object instance, default instance layer, no other resources in the resource tree, no other anything in the room. One circle displays. The other does not.
 
The only two explanations I can think of are 1) the location of one of the circles is outside of the view, or 2) you actually have more than one script and or object type, and you are calling and or placing the wrong one.
 

HayManMarc

Member
The only two explanations I can think of are 1) the location of one of the circles is outside of the view, or 2) you actually have more than one script and or object type, and you are calling and or placing the wrong one.
If the left side of the room is x = 0, then the first circle would indeed be outside the room.

Edit: Forgive me, I forgot about object placement. Please disregard.
 
Last edited:
E

Ephemeral

Guest
There is only one object in the resource tree. I created a brand new project to test this, as I already said.

I placed the instance in the center of the room, and the circle that does display is near the center of the screen as would be expected.
 
So you are positive the view is large enough to fit the second circle?

And I presume you double checked that you haven't actually somehow created two similiarly named scripts?
 
E

Ephemeral

Guest
It's a brand new project. The only things in the resource tree, are the default room, the one object, and the one script. The view and room are 1920 x 1080, the first circle appears near the center of the window as expected.
 
E

Ephemeral

Guest
The latest release version. Updated day before yesterday.
 
I presume you mean latest of GMS2. It could be a good idea to upload your new (all blank except the one instance and script) project, to see if anybody else with the same version of gamemaker is able to reproduce your problem.
 
I'm using the latest beta version of GMS 2. I tested your code just now and it works for me, I get two circles drawn either side of where I placed the object.
 

rIKmAN

Member
Did you copy / paste the code in your post from the IDE or rewrite it just for the post?

If you rewrote it here by hand I'm wondering if you have + or - in both the object and the script by mistake and are seeing 2 circles draw at the exact same position so it appears to be just one.
 
Have you also cleaned your project using the broom icon, just in case it has not fully cleared an old version of the code? That has been a culprit for incorrect results before.
 
Top