GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 Re: GML Code Help » Drawing maths curves in GM8 » 2013-11-15 17:35:33

Thank you again !
Yes, Imma change the room size : I'm using 800x592.
And of course, the noob that I am is gonna ask you : where to put those two lines {drawx = width * (xx - x0) / (x1 - x0); drawy = height * (y0 - yy) / (y1 -y0)} ?
And also, when you mean width and heigth in your formulas, do you mean room_width and room_height ?

#2 Re: GML Code Help » Drawing maths curves in GM8 » 2013-11-14 16:27:32

Again, thank you, xot !

I'm now experimenting some troubles with it... I mean, I'm using it in my final project, but I have a problem with entering the window...
But anyway, my real problem is here : I don't really understand this part of the code :

Expand1. var i, xx, yy;
2. for (xx=-3.2; xx<=3.2; xx+=0.001)
3. {
4.     yy = 0;
5.     for (i=0; i<=n; i+=1)
6.     {
7.         yy = yy + p[i] * power(xx, i);
8.     }
9.     draw_point(100*xx+320, 100*yy+240);
10. }

I know it's for drawing the points, but the lines 2 and 9 are quite strange for me... Why having xx=-3.2 ? And I don't understand the full command draw_point(100*xx+320, 100*yy+240);...

#3 Re: GML Code Help » Drawing maths curves in GM8 » 2013-11-14 07:38:10

NervaL928 wrote:

Also, now that I have this, I think it's possible to get functions like [tex]\frac{1}{x}[/tex] or [tex]e^x[/tex] or [tex]\sqrt{x}[/tex] or [tex]ln(x)[/tex], right ?

As for the other functions, that's no longer a polynomial, so it's not really clear what you asking for. You could replace the second block of code with:

Expand    yy = sqrt(xx);

... or whatever function of xx you want.

Thanks ! This will do !

About the "glitchy signs", I meant you get this : [tex]ax^n+bx^{n-1}+cx^{n-2}+...+Nx^{n-n} \to -ax^n+bx^{n-1}+cx^{n-2}+...+Nx^{n-n}[/tex]

Edit : the "320+100*xx, 240-100*yy" replacement worked and fixed the problem, so thatnk you again, xot !

#4 Re: GML Code Help » Drawing maths curves in GM8 » 2013-11-13 16:33:08

This is... AWESOME !
It works perfectly fine, thanks xot I'll credit you for this in my work !
Also, now that I have this, I think it's possible to get functions like [tex]\frac{1}{x}[/tex] or [tex]e^x[/tex] or [tex]\sqrt{x}[/tex] or [tex]ln(x)[/tex], right ?

And then, just a little thing more... Is it possible to have the curve without the points ? Or I mean, all the points ? Like, you don't have space between them ? If not, no matter, that's cool smile

Thanks again for your time, I looove this biggrin

Edit : for linking all the points, I changed "xx+=0,01" into "xx+=0,001" and it works fine :-)

Edit2 : the first monomial sign is glitchy... In fact, we get its opposed...

#5 Re: Script Alumni » sprite_replace_color() error... A bit annoying :) » 2013-11-13 14:39:31

Okay, so now I have the file !
Get in from my DropBox now : https://www.dropbox.com/s/v1igub18ccem7 … _color.gmk

Edit : now it recolors the full sprite into transparent one tongue

#6 Re: Script Alumni » sprite_replace_color() error... A bit annoying :) » 2013-11-13 06:23:40

Okay, I'm at school now, so Imma upload it for you this evening ;P

#7 GML Code Help » Drawing maths curves in GM8 » 2013-11-12 15:59:17

NervaL928
Replies: 9

Hello everybody :)

I got a problem with something, that I thought solution was on this page : http://www.gmlscripts.com/script/drawing_shapes
I didn't find anything interesting for me...

Since you have LaTeX installed, let me use it :)

What I want to do is basically calling number of monomials a functions has, and then you call for all the monomial values... Like in this :
[tex]f(x) \to ax²+bx+c[/tex]
You have three monomials (this is a polynomial of degree two in fact).
Note : usually, we don't use complicated functions, like [tex]x \to x^{18}[/tex], but others like [tex]e^x[/tex] or [tex]\frac{1}{x}[/tex] are very useful...

So here, I call for every constant values (I have a problem : how can I ask every constant values until there are no more constants ?) :

Expanda = get_integer("Enter a :","")
b = get_integer("Enter b :","")
c = get_integer("Enter c :",""

Now that I caught all the monomials values, how can I make the Game drawing Cƒ, the curve for the function the user entered ?
What I thought was using the room grid, but if it's not a first degree function (Cƒ is a line), it might be hard, right ?

Thanks for your replies, but if it's not possible don't matter, I'll try by myself, but note that I'm not posting this without having tried...

#8 Re: Community » Introductions » 2013-11-12 15:32:19

xot wrote:

Welcome to the forums, NervaL928. I look forward to seeing any submissions from you. I saw your comment on the sprite_replace_color script and have replied.

I don't know if we have any other French or French-speaking members. The forums don't see a lot of activity, to be honest.

Thanks smile
This forum should be more frequented !

xot wrote:

Do you make cool stuff with redstone?

I'm trying as I can smile
I make adventure maps (for now, none are released, but soon biggrin)

icuurd12b42 wrote:

Salut Nerval. I'm French too but not from France.

Salut smile Ravi de savoir que je ne suis plus seul !

#9 Script Alumni » sprite_replace_color() error... A bit annoying :) » 2013-11-12 15:28:38

NervaL928
Replies: 4

Okay guys :), today I found a problem with a script that I needed, so here's this script :
http://www.gmlscripts.com/script/sprite_replace_color

I posted a comment showing that I had an error, so to recap I get this happening :
http://img5.imageshack.us/img5/3862/5lil.png

I get as an answer to check if the sprite was Fully Black, which I did before posting my first comment in fact ;)
But this was a good idea in fact, so I re-checked it, and RGB color for the sprite is #000000 for all the sprite.

I was told to add more info, but I don't know what I can tell you more, if it's not the code in the object (script is exactly the same) :

Spoiler

In step event for the player (object called objectCharacter) :
sprite_replace_color(spriteCharacter,c_black,c_aqua)

#10 Re: Community » Introductions » 2013-11-11 11:45:31

Hello everyone !
I'm joining you today cuz' I often need scripts, but I would like submitting some also smile
I'm running Version 8 of GM for the info !
I also have the Standart version of GM:Studio, but I don't use it in fact.
Thanks xot for having created this site (^^,)
~NervaL928

PS : I'm French, so am I the only one in this case ? If yes, no matter, I'll speak English, as always !

Board footer

Powered by FluxBB