Just a disclaimer here, ‘week one’ of development is complete. However, what you see within this devlog (up until now) is NOT the current progress that has been made on this project. I am purposely working around any content that contains spoilers or reveals much about the game. The game is scheduled to be announced next month. From there I will be more open about development.
Tonight I’m going to talk about some other simple things that I added throughout the days. These features aren’t something that you may need during week one of development, but I want to get it out of the way and share as much as possible prior to announcement.
This is simple, but necessary for this type of game. Keyboards just don’t cut it for fast-paced platformers. I like to get gamepad support working, as soon as possible. I often implement them prior to keyboard controls.
However, Game Maker users have it easy. There are functions built-in to check if a gamepad (one or multiple) is plugged in, but they aren’t even necessary. I like to set things up as simply as possible. Take a look at the changes I made to the oPlayer ‘step event’
var kLeft, kRight, kUp, kDown, kJump, kJumpRelease, tempAccel, tempFric; kLeft = keyboard_check(vk_left) || gamepad_axis_value(0, gp_axislh) < -0.3; kRight = keyboard_check(vk_right) || gamepad_axis_value(0, gp_axislh) > 0.3; kUp = keyboard_check(vk_up) || gamepad_axis_value(0, gp_axislv) < -0.3; kDown = keyboard_check(vk_down) || gamepad_axis_value(0, gp_axislv) > 0.3; kJump = keyboard_check_pressed(ord('Z')) || gamepad_button_check_pressed(0, gp_face1); kJumpRelease = keyboard_check_released(ord('Z')) || gamepad_button_check_released(0, gp_face1);
Basically, all that I am doing here is checking both the keyboard and the ‘slot 0’ gamepad for input. Note that the first parameter for all gamepad-related functions is the device number, starting at zero. Also, ‘axisl’ refers to the left joystick and ‘gp_face1’ refers to the ‘A’ button (on an Xbox360 controller).
Music Fade In/Out
Some users are unaware that Game Maker has implemented a new audio engine. This changes things immensely, but it is by far superior to the original. One thing that I tend to dislike in my games is jarring music transitions. For example, happy level select screen to sudden boss battle showdown. I much prefer a fade in/out.
Using the new audio engine, you can achieve these effects in three simple steps.
1) Set a gain start point.
// After 0 milliseconds, set the gain of 'sampleTrack' to 0 audio_sound_gain(sampleTrack, 0, 0);
2) Play your sound.
// Play 'sampleTrack' with priority 0 (the flag is whether or not to loop the track) audio_play_sound(sampleTrack, 0, true);
3) Set a gain end point.
// Adjust the gain of 'sampleTrack' to 1 (volume is 0 - 1) over the course of 1000 milliseconds (1 sec) audio_sound_gain(sampleTrack, 1, 1000);
And there you go, a simple fade-in effect. I typically fade in one track while fading out the other in half the time.
Room Fade In/Out
Like the jarring music transitions, I also dislike abrupt room changing. Typically, I’ll create a bunch of transition and effect objects. Every room will include ‘oFxFadeInStd’. This is the standard fade-in when the player begins a level (or when the level restarts due to loss condition).
// oFxFadeInStd 'draw end event' draw_set_alpha(image_alpha); draw_rectangle_colour(view_xview, view_yview, view_xview + 640, view_yview + 360, c_black, c_black, c_black, c_black, false); draw_set_alpha(1.0); image_alpha -= 0.2; if (image_alpha <= 0) instance_destroy();
Simple enough. The object just draws a black rectangle over the view port and fades out (meaning the scene itself fades in) over several frames. It’s typically quick so that it doesn’t slow down game flow.
I’m keeping this one short, it has been a long day!
3 thoughts on “DevLog: Creating a Platformer Pt.5”
Reblogged this on Coding, Unix & Other Hackeresque Things.
Hello admin of this blog, do you allow guest
posting ?? Please let me know, i am interested 🙂
I haven’t in the past, but I wouldn’t be 100% against it. I’d prefer if I was contacted directly to discuss content rather than letting others openly post though. 🙂
Feel free to contact me at zbell91[at]comcast[dot]net.