Help - Search - Members - Calendar
Full Version: Charny Scripts
Game Maker Community > Working with Game Maker > Extending Game Maker > Scripts [GML]
Charny
Hello, welcome to my scripts thread!


I will add new scripts everyday!

Please, post a comment on this thread if you use one of my scripts.
If you find any bugs with one of my scripts, post it here.

Updates :

I added a GMK with all the scripts.

You can :

- Use my scripts in your game without giving credits
- Post my scripts on another thread or on another forum if you give me the credits and a link to my scripts thread.
- Add things to my scripts nor change them, but you still give me the credits. If you want to get a part of the credits, post the modified script on this thread.

You can't :

- Post one of my scripts on another forum/thread and say that you made it.
- Use my scripts in your game and say that you made it.

The scripts (Download) :



Content :

1- Geometry
- Area
- Total area
- Perimeter
- Volume

2- Geometry (Drawing)
- Shapes
- 3D shapes
- Shape's developpements

3- Math
- Pythagoras
- Variation rate

4- Fractions & decimals
5- Extended functions
6- Others
- Movements
- Following
- ect..


--------------------------------------------------------------------

1. Geometry

Area - These scripts will return the area of a shape.

rhomb_area()

rectangle_area()

triangle_area()

trapezium_area()

parallelogram_area()

polygon_area()

circle_area()

Sector of a disk(area) :

sector_interior()

sector_exterior()

Total area - These scripts will return the total area of a shape.

square_total()

prism_total()

recpyramid_total()

cylinder_total()

cone_total()

sphere_total()

Perimeter - These scripts will return the perimeter of a shape.

rhomb_perimeter()

rectangle_perimeter()

triangle_perimeter()

trapezium_perimeter()

parallelogram_perimeter()

polygon_perimeter()

circle_circumference()


Volume - These scripts will return the volume of a shape.


cylinder_volume()

recpyramid_volume()

trpyramid_volume()

sphere_volume()

prism_volume()

2. Geometry (Drawing)

Shapes - These scripts will draw a shape.

draw_parallelogram()

draw_polygon()


3D shapes - These scripts will draw a 3D shape.

draw_3dpyramid()

draw_3dpyramid2()

draw_3dcone()

draw_3dprism()

draw_3dcylinder()


Shape's developpements - These scripts will draw the developpement of a shape.


dev_pyramid()

dev_cylinder()

dev_prism()


3. Math :


Pythagoras :

pythagoras_hyp()

pythagoras_cat()

Variation rate :

variation_rate()

4. Fractions & decimals:

decimal_to_fraction() This script will change a decimal number to a fraction, without whole number (e.g : 60/30)

decimal_to_fraction_whole() This script will change a decimal number to a fraction, with whole number (e.g : 1 1/15)

fraction_to_decimal() This script will change a fraction to a decimal number.

reduce_fraction() This script will reduce a fraction.

fractions_addition() This script will add a fraction with another fraction.

fractions_subtraction() This script will subtract a fraction to another fraction.

fractions_multiplication() This script will multiply a fraction with another fraction.

fractions_division() This script will divide a fraction to another fraction.


5. Extended functions

instance_create_ext() This script will create an instance with more arguments, speed, alpha, color, direction, angle.

6. Others

Movements :


arrows_movements() With this script, you will be able to move an instance with the arrows keys.

wasd_movements() With this script, you will be able to move an instance with the 'W' 'A' 'S' and 'D' keys.

numpad_movements() With this script, you will be able to move an instance with the numpad keys.

Following :

follow_object()

follow_mouse()


Charny
CaptainLepidus
You realize that everyone of those scripts (with the exception of instance_create_ext(), I don't even know what that is!) is inside my easyGML?
Charny
I don't care?

And hmmm... I'm currently working on new scripts and libs.
CaptainLepidus
I'm just saying, there probably will be competition.
Charny
Hmmm....

Most of the scripts that I made(Which aren't released yet) are based on geometry and math.

wink1.gif
Charny
Ultra Mega BUMP!
millzyman
for your follow_object()

*Please note: this is a suggestion... You can use it if you want no credit required*

CODE
if (distance_to_object(argument0)>0)
{
mp_potential_step(argument0.x,argument0.y,argument1,argument2);
}
else
{
speed=0;
}
image_angle=direction


Arguments:
0-object
1-speed
2-Allow mp_potential_step to check for solid or all collisions


mp_potential_step() will allow the object to avoid solid or all (depending on your true and false decision)

I am not trying to undermind you, but hey it could just be for future reference, use as you please (or if you want)


Edit:

I see you updated. You have some alright scripts there. Good to see mate
Charny
Thanks wink1.gif. I will credit you for the updated script.
kryptos
Well. A script without any comments explaining what it is supposed to do is just useless.
Charny
Hmmm.... the name explains what the script is doing... but if you want, I can say what the scripts are doing.

kryptos
Actually the name of a script never said what it is really doing except for the creator of that script. Because you know it, you have the false impression the name just fit. But people does not think the same way.
It is the reason why there are always documentation with API, libraries or components. Because the name of a script/function/class, although necesary and useful, doesn't tell everything.

For example, when I first see the script instance_create_ext, I had no idea what I was about. More precisely I had several completely different ideas. And when I read the script, I realized that none of them was what the script really does.
Charny
Ok... I see. I updated the thread. I added a description for most of the scripts.
Charny
Bump...
Charny
BuMp

Post comments & suggestions please sad.gif
voltain
I'm pretty sure you could have shortened half of these scripts. For example decimal_to_fractions

CODE
var xx,yy,decimal,number,sur,fraction,i;
decimal = string(argument1);
number = string_length(decimal);
fraction = power(10,number);
sur = argument1+(argument0*fraction);
xx = sur;
yy = fraction;
i=0;

if (argument2)
{
    for (i=2; i<10;i+=1;)
        {
            while (xx mod i)=0 && (yy mod i)=0
                {
                 xx = xx/i;
                 yy = yy/i;
                 }
        }
}
return string(xx)+"/"+string(yy)


Your version (excluding commenting) is about 8 times longer than the one above. The scripts are okay but one of the best trait's of a good programmer is being able to make code as short and efficient as possible. In fact I think that someone more advanced than me could make this shorter. Also try to indent your work because it makes it easier to read.

Charny
Ok, thanks. I will fix them.
Charny
BUMP
gmx0
finally more math scripts!
Charny
Thanks ;D
Charny
Bump
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.