I Wanna Community
Fangames => Game Design => Programming Questions => Topic started by: l3agu32 on June 28, 2016, 07:16:16 PM
-
I wanna make this using the yoyoyo engine in game maker studio. I actually succesfully did this, but I have to change all scripts and objects related to the kid considering each room, so I'm curious if advanced game maker users know a faster way.I think some fangames already made something like this (for instance, pokemon area in "I wanna run the marathon"). In only some rooms, I want the normal kid object not to exist, eliminate all sounds related to the kid like shooting and jump and not let the player use "Q" to suicide. Thank you!
-
How I would do something like this is find all the behaviors I want to disable, and wrap each of them in a conditional (if statement) that checks a script to see if the effect is currently active.
So for example, in the pokemon area in run the marathon, I had a script called roomIsPokemon which looked something like this:
return argument0 == rPokemonOverworld
or argument0 == rPokemonGym
or argument0 == rPokemonHouse
or argument0 == rPokemonHouse2
or argument0 == rPokemonCenter
And then to disable pressing R, I found where that logic was and did an additional check with that script:
if (scrButtonCheckPressed(global.restartButton)
and !roomIsPokemon(room)) // added this check
{
/* ...
restart game
...
*/
}
I also called that script in many other places. And you can imagine changing that script to just check a global variable instead of a room, or whatever other logic.
-
Patrick, just so I can understand better, how did you eliminate the normal kid in case that different kid wasn't the normal kid object?
-
To remove the normal player when entering the room, I would first destroy the player object since it's persistent. And also be sure there's no player start object in that room, obviously. So,
example warp object or something:
if place_meeting(x, y, objPlayer) {
with objPlayer instance_destroy()
room_goto(rPokemonHome)
}
I guess another thing is how to deal with saving and loading with an alternate player. In my save and load scripts, I added a check for the effect (the roomIsPokemon script above). If it returns false, then proceed as normal. If it returns true, then save and load the alternate player's position. For example:
in scrSaveGame:
if roomIsPokemon(room) {
global.savePlayerX = objPokemonPlayer.x
global.savePlayerY = objPokemonPlayer.y
}
else {
// normal kid
global.savePlayerX = objPlayer.x
global.savePlayerY = objPlayer.y
}
in scrLoadGame:
if roomIsPokemon(global.saveRoom) {
instance_create(global.savePlayerX, global.savePlayerY, objPokemonPlayer)
}
else {
// normal kid
instance_create(global.savePlayerX,global.savePlayerY,objPlayer)
}
And you can imagine having multiple else-ifs if you have multiple alternate players, like run the marathon does. Hope that helps.