[ 8 posts ]  Reply to topicPost new topic 
Author Message
 [us]
 Post subject: Gradius Checkpoint Help
PostPosted: Tue Nov 15, 2016 8:30 am 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I know this has nothing to do with Mario at all. But I need help on how to deal with the checkpoint.


EXAMPLE:
If I get destroyed before the checkpoint reach, then it reaches be back at the stage. Then, at the certain point, I teleport towards that checkpoint and continue on. It seemingly seems difficult for me to figure out.

Image

1st part: When destroyed at the beginning, I reset back towards my origin (sorry I didn't show you that)
2nd part: When destroyed after the point, my position will be on the checkpoint.

*BTW, I'm using Game Maker Studio for this.

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [tr]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Tue Nov 15, 2016 10:05 pm 
User avatar
Thanks DonnieTheGuy!
Administrator
[A]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
Create an object called obj_checkpoint. Don't give it any sprites.
Step event:
Code:
if (obj_player.x > x) {
    global.checkpointx = x
    instance_destroy()
}

Now add this to the create event of the player
Code:
x = global.checkpointx

Be sure you reset the checkpoint variable after finishing the level.

_________________
Image
 
Top
Offline 
 
 
 [us]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Wed Nov 16, 2016 8:11 am 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
I did what you want me to do, but it gave me this:
Image

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [at]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Wed Nov 16, 2016 8:31 am 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
If you aren't aware why you get that error you should probably watch some coding tutorials starting from zero.

No offense but you won't be able to put together a game (if the coding depends on you) if you don't know how to initialize a variable.

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [zz]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Wed Nov 16, 2016 4:10 pm 
User avatar
Mr. Awkward's Lab Assistant
Member
[*]
[*]
SonicZetrex wrote:
I did what you want me to do, but it gave me this:
Image

You forgot to set global.checkpointx=0 at the beginning of the game. At game start.
Or preferably, I suggest you make the first room one filled with global variables in the creation code tab, followed by good old room_goto_next(). It will also aid in learning Save/Load functions in GMS.
Also, another tip: set global.checkpointx to 0 at the end of a level as well, but not in room end. Make an object to collide with that will end the level.

_________________
=|
 
Top
Offline 
 
 
 [tr]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Wed Nov 16, 2016 4:56 pm 
User avatar
Thanks DonnieTheGuy!
Administrator
[A]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
Yeah I thought you would know how to initialize a variable, that's like one of the most basic things in coding.

_________________
Image
 
Top
Offline 
 
 
 [us]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Wed Nov 16, 2016 7:11 pm 
User avatar
"I am one valuable card"
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
(Mors) I will never forgive myself...I didn't even know that your method can actually work.

(DJ Coco) Yes, I know how to initialize the variable. It's just that I didn't know that I supposed to do it in a room, not in an object.

(Mocgames998) Thank you for giving me a hint for putting it in a room instead of an object. I'm an insolence sometimes, but mostly I know what I'm doing.

_________________
Image
Image

Image
NNID: SonicZetrex
User: SonicZetrx


Old Drawing Banners

Spoiler:

Things I support/others

Spoiler:


My favorite theme:

 
Top
Offline 
 User page at mfgg.net
 
 [at]
 Post subject: Re: Gradius Checkpoint Help
PostPosted: Thu Nov 17, 2016 12:00 pm 
Cliax Codec X Splatoon
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
You can initialize the variable any way you want, it just has to be before you use it.

_________________
Image

Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions?

Currently designing Chapter 1-6, 5%

GOTM titles
Spoiler:
Fan Art
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
 [ 8 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group