Game Maker : Scrolling credits

Action: scrolling credits then the game ends.

I was searching for this coding for so long, so I really need to do a record.
Hope someone who need this will find it.
I will try my best to explain.

Pre-work

create a obj_credits, put into the room gonna show the credits.

 

Create event

Create event:https://hastebin.com/evaraqeguz.scala
this coding is quite straight forward, so I just write the explanation in the coding.

 

Draw event

Draw event:https://hastebin.com/qojamowuju.lisp

if (y < -string_height(credits)) y = room_height;

i still don’t understand this coding, but it seems like avoiding something about y axis.

 

if (alarm[0] = -1) alarm = 5850;    

I was so happy when I saw this coding.
I tried to figure out the alarm while making The Re:tired Hero, but couldn’t find out until today.

Need to be aware of  the alarm need to be active for using it, so you need to give an action to make it start working.

Usually, alarm is using like:

if (place_meeting (x,y+10,obj_message)
{
   with (obj_message)
   {
      alarm[0] = 180;
   |
|

I find out that most of alarm are using in collision, so again I was so excited to see this coding.

if (alarm[0] = -1)

This line is for checking that is the alarm working or not.
so in this line I wrote, if the alarm[0] is not working.
then the coding next to the bracket is the result of the alarm is not working.

so I set  alarm = 5850;
which means : if the alarm[0] is not working, then set the alarm = 5850 frames.

In the result,  the alarm is active and after 5850 frames,  game maker will trace the coding in the alarm event.

 

Alarm event

Once understand how to make the alarm be active, then alarm is not hard any more (I think XD)

game_end();

The coding in alarm event is usually straight forward, just some basic codes.
( I mean…..in my game :P)

Advertisements

Game maker : message

Action: After pressing a key from keyboard, the message goes to the next one.
* There will be a message shows up before pressing.

Pre-work

Create a object for showing message and put it into a room.

 

Create event

Create event : https://hastebin.com/oyidahukan.ini
Some parts I didn’t explain because I’m not too sure about it.

 

Draw event

Draw event : https://hastebin.com/ixiruqetuf.go
Draw event is the hardest part in this coding.

I don’t really understand the part I didn’t leave explanation with.
By the way, there are lots of way to introduce the position of x and y, so for me I just keep change the vlaue for finding the best place.