Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Wednesday, April 29, 2020

Discord on Linux Mint Debian Edition (LMDE 4)

What is discord? As the website says:
Discord is the easiest way to communicate over voice,video, and text, wether you're part of a school club, a nightly gaming group, a worldwide art community, or just a handful of friends that want to hang out.

To install Discord on Linux Mint Debian Edition a.k.a LMDE 4 Debbie, open the Software Manager apps, go to search, insert the keyword Discord and click install button. And thats it.. ...wait what?

Please take a look at the list of change below. 722.2 MB will be downloaded in total. 2.5 GB more disk space will be used.  O_o"

Unfortunately, Discord only available from flatpak packages and not in the repositories as apt-cache policy returns nothing.

So the Software Manager wants to install Flatpak first before it can install other packages.

Maybe, Flatpak has some benefical as it said it allow the packages to be distro independent and more secure than installing unofficial packages. But hey, i will choose unofficial path for now :)

And yes, the Discord websites provide "unofficial" packages to be downloaded.

Save it to the hard disk.



2.2 MB will be downloaded in total. 179.1 MB more disk space will be used.

Install it and enjoy more free GB's for another use :D

Friday, January 24, 2020

GameMaker Studio 2 - Build-In Functions

4. BUILD-IN FUNCTIONS

Last post we have learn how to draw a rectangle using draw_rectangle () function. This function is a build-in functions that available within the GameMaker Studio 2 Language (GML). For all the list of available functions along with the required arguments and examples of code to show how thy can be used, we can look it at the documentations from yoyogames here.

Aside from the web documentations, middle click at the function within the editor will open a documentation tab to find some brief explanations and examples.








Now lets "move-along" with the lesson from sheepolution.com. 😀

Just like the post before, we start by drawing another rectangle in the draw event :

//Draw a rectangle
draw_rectangle(100,50,200,150,true);


When we look at the documentations, the numbers are x and y position of the left corner rectangle against the GameMaker room, as of (0,0) is located at the top left of the screen or at the top left of the GameMaker room.










draw_rectangle(100,50,200,150,true);

100 = The x coordinate of the top left corner of the rectangle.
50   = The y coordinate of the top left corner of the rectangle.
200 = The x coordinate of the bottom right corner of the rectangle.
150 = The y coordinate of the bottom right corner of the rectangle.
true = Whether the rectangle is drawn filled (false) or as a one pixel wide outline (true).




















And now, how to make the rectangle move? 
When the rectangle move, means the coordinates is being altered either by adding some amount of value or by subtract some amount of value.

In LÖVE framework (as written at sheepolution.com tutorials), we do this by using code :

function love.load() x = 100 end
function love.update() x = x + 5 end
function love.draw() love.graphics.rectangle("line", x, 50, 200, 150) end


Lets add a Create event :
x = 100;

And add a Step event :
x = x + 1;













And modified the draw event :
draw_rectangle(x,50,200,150,true);


and things become very weird :
Why is that?

Lets take a look at the function that we write in the draw event :

draw_rectangle(x1,y1,x2,y2,true);
draw_rectangle(x,50,200,150,true);

We only alter the value of x1 but not x2, thats why. The x1 is moving along 1 pixel at a time at x axis, but the x2 is not moving because the value is fix at (200,150) coordinates.

Now lets fix the code :

draw_rectangle(x,50,x+100,150,true);

why is x+100, not x+200 ?
Well, we have create a variable in the Create event :

x = 100

so x+100 equal to 100+100 = 200.

If we run the game now, the rectangle now should move normally.

GameMaker Studio 2 - LÖVE

3. LÖVE

LÖVE is a framework, a tool that makes programming games easier.
.....wait, what ? 😁

I was browsing through some game engines that run on linux and i found this sheepolution.com, a beautiful web contain tutorials for LÖVE game engine. Its written there, that LÖVE calls 3 functions :




- love.load()
- love.update()
- love.draw()

To draw a rectangle using LÖVE, we do the following :

function love.draw() love.graphics.rectangle("fill", 100, 200, 50, 80) end

What about GMS2 ?
Lets create a GameMaker Language Project, double click on the room0 and set it to 640 width and 480 height in room properties.











Lets create an object by pressing Alt + O.  An Object Window will appear alongside with event window.

There are lots of event listed there, but as far as i know, following LÖVE main functions, the three main event is create event, step event, and draw event.

To draw a rectangle using GMS 2, we do the following :

Add a draw --> draw event. Another window will pop up where we can write our code.
We add functions :

//Draw a rectangle
draw_rectangle(100,200,50,80,false);

Now, go to room tab, and drag the object from the right panel into room0.











Run the game by pressing F5, and voila, there's the rectangle 😊

Friday, February 3, 2017

Newbie Tutorial GameMaker Studio 2 - The Sign Post

Hello there. Today i'm gonna write about how to make a sign post on GameMaker Studio 2.

This is not really a tutorial, is just step by step how i do it.
If you ask me where i get the font on the left gif picture, its called m3x6 font, and i download it from managore.itch.io 

You should have your player and movement set up before you can follow this step by step how to make a sign post.

From my point of view, a sign post is similar from Non Playable Character or NPC. The different is a sign stand still and an NPC wanders around. Well, NPC also need you to push the action button to interact and -maybe- he/she can have multiple answer/branch.

Ok. First, prepare the sprites for the sign. Set the origin to Top Center and then...
..... err, maybe i should skip into the code instead?

Create a font asset, and set it to your needs. For this example i name the asset fntDefault, use m3x6 font, set the font size into 11 and turn off anti-aliasing mode.
Create object Sign Post. Assign the sprite that we draw earlier into the object, and then add 3 events.

Create - the code that runs on the creation of the object
Step - the code that runs on every game frame
Draw - also runs on every game frame to draw something

On the Create events :

// initialize the object
trigger = 0;          // the on and off trigger
textToShow = "";      // the text to draw







On the Step events ;

if (place_meeting(x,y,objPlayer)){     // if the player is touching the sign
    trigger = 1;                       // turn the trigger on
    }                                    
else {                                 // if there is no player around
    trigger = 0;                       // turn back the trigger off
    }                                  // end of code

On the Draw events :

draw_self();                          // Draw the Sign Sprites

if (trigger == 1){                   // if the trigger is on
                                      // this section is to draw the black shadow font
    draw_set_alpha(0.7);              // set the font to 30% transparant
    draw_set_color(c_black);          // the font color, black
    draw_set_halign(fa_center);       // the horizontal align, center
    draw_set_valign(fa_bottom);       // the vertical align, bottom
    draw_set_font(fntDefault);        // font to use, fntDefault
    draw_text (x+1,y-5+1,textToShow); // draw textToShow
// the magic number -5- is how hight your font from the origin of the sprites and
// the x+1 and y+1 is one pixel away to the right and down from the original font
   
                                      // this section to draw the font
    draw_set_alpha(1);                // set the font to 100% visible
    draw_set_color(c_white);          // same as above
    draw_set_halign(fa_center);
    draw_set_valign(fa_bottom);
    draw_set_font(fntDefault);
    draw_text (x,y-5,textToShow);

    }


put the object into the room. And.. nothing happened. 😐




No text to show?

Ofc. remember the code?
textToShow = "";

We have to write something into it. But wait, how to make every object different?
Instead of filling the "textToShow" into the object code, we alter the value from the creation code. Go to the room and double click the object.

And thats it. I hope you like what i write. See ya next time.