Tuesday, February 21, 2017

Grass Animation

Wikipedia says :

Platform game (or platformer) is a video game which involves guiding an avatar to jump between suspended platforms and/or over obstacles to advance the game. The player controls the jumps to avoid letting the avatar fall from platforms or miss necessary jumps. The most common unifying element of games of this genre is the jump button, but now there are other alternative like swiping in touchscreen. Jumping, in this genre, may include swinging from extendable arms, or bouncing from springboards or trampolines. These mechanics, even in the context of other genres, are commonly called platforming, a verbification of platform.

From over the internet, feedback -they said- is one factor that make a platformer, or maybe any game feels good. It is how the character actually interacts with the environment. The dust animation is one thing. With this little effect, it makes a lot of different how the game look and feel. The game is more "visually polished" and pleasing to play.

Dust effect.









This time i try to make the grass, or flower maybe, or any kind of cosmetics decorations animated when the player is interact with it. I follow a tutorial from https://zackbellgames.com/ using a sprite skewing and triangle strip to make the grass wiggle.

And the result is
The flower will move a bit when the player interacted with them.

And, with some layering setup, i got some depth effect bonus as the result. 

Thursday, February 16, 2017

Creating a Tileset Attempt

Creating a tileset is not as-fun-as creating the first tile. 😕

I've been trying to make a nice tileset on and off on my sparetime between my real-life activity. A thousand attempts 😁 of create new, not-so-good-result and erase file is what i am doing for a while.


Sometimes it makes me lose my interest and motivation but here it is, temporary result of tileset.

Tuesday, February 7, 2017

GameMaker Studio 2 Simple Parallax Background

Many tutorials of Game Maker Language parallax background over the internet is using view_xview() and view_yview() function. Unfortunately, this function is deprecated in GameMaker Studio 2. 😕

While searching for the rightway to do the parallax background, the very basic view_current example script from the gamemaker documentation give a nice parallax effect too. 


Solid color background :
So, here is the description from view_current syntax :

Description

This read only variable is only valid in the Draw Event and returns the current view port being rendered. The return value will change during the draw event when you have various views as the draw event is called once for each view port in succession. So when (for example) you are using view port[0] and view port[1] in your game room, the draw event for ALL instances will be run twice, once for each port, and with this variable you can check to see what view is currently being drawn. In general, this is used to only render specific details to a single port when multiple view ports are visible in the room at the same time. See the example code below.

Syntax:
view_current;

Returns:
Real (view port index from 0 to 7)

Example:
if view_current == 0
   {
   var xx = camera_get_view_x(view_camera[0]);
   var yy = camera_get_view_y(view_camera[0]);
   draw_text(xx + 32, yy + 32, "Player 1");
   }
else
   {
   var xx = camera_get_view_x(view_camera[1]);
   var yy = camera_get_view_y(view_camera[1]);
   draw_text(xx + 32, yy + 32, "Player 2");
   }

The above code checks to see which view is currently being drawn and then draws a different text to each view based on the return value.

How to implement it?

Simply create an object and create an instance layer. Put the layer behind other layer and put the object there.

On the object draw event :


if view_current == 0
   {
   var xx = camera_get_view_x(view_camera[0]);
   var yy = camera_get_view_y(view_camera[0]);
   draw_sprite_tiled(sprBackground,0,xx/2,yy);
   }



And thats it. A nice one-layer parallax background. 
Please comment for the rightway to do it. Hey, i'm a newbie anyway. 😁




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.


Wednesday, February 1, 2017

The Platformer Movement Engine


From the last movement engine, finally i have added some more behaviour to the engine to make it feels more complete. More states, more animations, more effects and more conditions and behaviours.

Its just like an advanced platformer movement engine in the hand of a newbie because of the complexity of the movement, yet only use the basic of gamemaker language script 😂. 

As a beginner, my engine heavily use IF conditional operator for one expression onto another. And it took me couple of days just to fix silly bug. Ofcourse maybe there is more bug yet to be found later on.

And here is the results:


Walking and running.

Jumping


Doublejump-ing



Ducking and sliding



Hanging on the wall


Wall sliding


And ledge grabbing.
















So what do you think? 
Would you buy my game someday? 😅