Hi all, I'm trying to make a platformer, and right now I'm having trouble with the swimming portion. Whenever I swim into a Block_Big (the object I use as a wall, and to stand on, etc.) from underneath, my character rapidly shakes up and down instead of simply moving up alongside the block. Any ideas?
Here's all the relevant code, all within the player character object (Char):
Collision Event with object Block_Big:
move in direction 270 at most 4 till a contact with solid objects
set the vertical speed to 0
Step Event:
COMMENT: check if in air
if relative position (0,1) is collision free for Only solid objects
if at relative position (0,0) there is object Water_Block_Obj
set the gravity to .2 in direction 270
COMMENT: limit vert speed
if at relative position (0,0) there is object Water_Block_Obj
if vspeed is larger than 3
set variable vspeed to 3
else
if vspeed is larger than 5
set variable vspeed to 5
Key Press Event for Up Key:
if can_move is equal to 1
if at relative position (0,0) there is object Water_Block_Obj
if global.can_swim is equal to 0
if global.jump_height is equal to 0
if relative position (0,1) gives a collision with Only solid objects
set the vertical speed to -2
else
if global.jump_height is equal to 1
if relative position (0,1) gives a collision with Only solid objects
set the vertical speed to -4
Keyboard Event for Up Key:
if at relative position (0,0) there is object Water_Block_Obj
if global.can_swim is equal to 1
set the vertical speed to -2
- Game Maker Community
- → Viewing Profile: Topics: BoronBananez
BoronBananez
Member Since 22 Dec 2011Offline Last Active Jul 26 2012 07:20 PM
Community Stats
- Group New Member
- Active Posts 65
- Profile Views 368
- Member Title GMC Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
-
Version
GM8
0
none
Friends
BoronBananez hasn't added any friends yet.
Topics I've Started
Bumping ceiling while swimming?
16 July 2012 - 03:31 AM
Warping into two rooms simultaneously?
11 July 2012 - 05:19 AM
Hi everybody. I've been going insane trying to figure this one out. Any help would be hugely appreciated
I'm trying to make a platformer where the player character moves from one room to the next whenever he touches certain objects. I'm a beginner so I asked and someone was nice enough to give me an example of a system to do this. I've implemented the system, but it seems there's a problem with it-- when I try to warp from one specific room to another, I seem to be warping into the same exact spot in both rooms at the same time, so the game tries to mix the two together. I find objects from both rooms, in the same coordinates they are in their respective rooms, but in one room at the same time.
Here are the specifics: I'm using an object in the title screen to set up the variables that will allow me to warp. WarpRoom is the variable telling the game which room to warp to, and WarpX/WarpY tell the game what coordinates to warp to within a room.
Each room's creation code is set up to tell the game which objects within the room go to which rooms when the player touches them. The objects themselves hold the information for what coordinates to move the player to within the rooms.
Here's the relevant code:
In the title screen object creation event-
globalvar WarpDestination, WarpX, WarpY;
In the title screen press 'a' event-
WarpRoom=Cygnus_Temple;
WarpX=1952;
WarpY=1136;
transition_kind=20;
room_goto(WarpRoom);
In the Cygnus_Temple room creation code-
instance_create(WarpX,WarpY,Char);
instance_create(Char.x,Char.y,Player_Health_Controller);
Temple_Fall_Warp.MyWarpRoom=Temple_Fall;
//where I'm having problems is that last one, the Temple_Fall_Warp object seems to be taking me to a mix of the Temple_Fall and Cygnus_Temple rooms. I've tried switching Temple_Fall out for other rooms, and the same thing happens; it becomes a mix of the first room I went to when I started the game (in this case Cygnus_Temple) and whatever other room I warp to after that. This happens the same way when I switch out Cygnus_Temple for another room as the start room.
In the Temple_Fall room creation code-
instance_create(WarpX,WarpY,Char);
instance_create(Char.x,Char.y,Player_Health_Controller);
In the Temple_Fall_Warp object collision event with the Character (Char)-
WarpX=928;
WarpY=704;
WarpRoom=MyWarpRoom;
transition_kind=14;
room_goto(WarpRoom);
And in the creation event for the Temple_Fall_Warp object-
var MyWarpRoom;
Any and all help you could give would be fantastic.
I've tried everything I can think of to fix this, but I come up with zilch. I've even tried removing all of the variables except WarpX/WarpY and just having the objects themselves contain all the info for where to go (the coordinates and the room), but it still happens. Every single time, the room I warp to is some nightmarish mix of the starting room and the one I 'should' be going to.
I'm trying to make a platformer where the player character moves from one room to the next whenever he touches certain objects. I'm a beginner so I asked and someone was nice enough to give me an example of a system to do this. I've implemented the system, but it seems there's a problem with it-- when I try to warp from one specific room to another, I seem to be warping into the same exact spot in both rooms at the same time, so the game tries to mix the two together. I find objects from both rooms, in the same coordinates they are in their respective rooms, but in one room at the same time.
Here are the specifics: I'm using an object in the title screen to set up the variables that will allow me to warp. WarpRoom is the variable telling the game which room to warp to, and WarpX/WarpY tell the game what coordinates to warp to within a room.
Each room's creation code is set up to tell the game which objects within the room go to which rooms when the player touches them. The objects themselves hold the information for what coordinates to move the player to within the rooms.
Here's the relevant code:
In the title screen object creation event-
globalvar WarpDestination, WarpX, WarpY;
In the title screen press 'a' event-
WarpRoom=Cygnus_Temple;
WarpX=1952;
WarpY=1136;
transition_kind=20;
room_goto(WarpRoom);
In the Cygnus_Temple room creation code-
instance_create(WarpX,WarpY,Char);
instance_create(Char.x,Char.y,Player_Health_Controller);
Temple_Fall_Warp.MyWarpRoom=Temple_Fall;
//where I'm having problems is that last one, the Temple_Fall_Warp object seems to be taking me to a mix of the Temple_Fall and Cygnus_Temple rooms. I've tried switching Temple_Fall out for other rooms, and the same thing happens; it becomes a mix of the first room I went to when I started the game (in this case Cygnus_Temple) and whatever other room I warp to after that. This happens the same way when I switch out Cygnus_Temple for another room as the start room.
In the Temple_Fall room creation code-
instance_create(WarpX,WarpY,Char);
instance_create(Char.x,Char.y,Player_Health_Controller);
In the Temple_Fall_Warp object collision event with the Character (Char)-
WarpX=928;
WarpY=704;
WarpRoom=MyWarpRoom;
transition_kind=14;
room_goto(WarpRoom);
And in the creation event for the Temple_Fall_Warp object-
var MyWarpRoom;
Any and all help you could give would be fantastic.
I've tried everything I can think of to fix this, but I come up with zilch. I've even tried removing all of the variables except WarpX/WarpY and just having the objects themselves contain all the info for where to go (the coordinates and the room), but it still happens. Every single time, the room I warp to is some nightmarish mix of the starting room and the one I 'should' be going to.
Player Object Code Confusion
19 June 2012 - 04:15 AM
Hi all. I've got a tricky problem, and I'd be forever grateful for some help. I'm trying to program the player object for a side-scrolling platformer. I've successfully pulled off running, walking, swimming, climbing, and digging, and now I'm trying to program something where the character can float over metal spikes (kind of a repellant magnet effect). I've got it down fine as far as the gravity effects for the character go, but I can't seem to get it to work in the press right and left events. Here's what I have for left so far, without the actions for the magnet object:
Note: After posting this I realized that the indentation in the code denoting brackets doesn't show up in the post for some reason. Any ideas how to fix that?
Keyboard Event for Key: Left
if can_move is equal to 1
set variable previous_direction to 1
COMMENT: Run_speed 0
if global.run_speed is equal to 0
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed 1
else
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
COMMENT: Run_Speed 1
if global.run_speed is equal to 1
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed .5
else
if at relative position (0,0) there is object Dig_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if pressing_vertical is equal to 0
set the sprite to Char_Dig_L with subimage 0-15 and speed 1
else
if at relative position (0,0) there is object Water_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-2,0) is collision free for Only solid objects
jump relative to position (-2,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
else
if relative position (-2,-4) is collision free for Only solid objects
jump relative to position (-2,-4)
move in direction 270 at most -1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
This works fine. But when I try to add the actions in for the magnet, weird stuff starts happening. First, when I'm moving through the magnet area in-game, the character moves much faster than the code is telling him to (as far as I can tell, of course). Also, depending on where I insert the code, it affects different other movement attributes. Here's one attempt:
Keyboard Event for Key: Left
if can_move is equal to 1
set variable previous_direction to 1
COMMENT: Run_speed 0
if global.run_speed is equal to 0
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed 1
else
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
COMMENT: Run_Speed 1
if global.run_speed is equal to 1
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed .5
else
if at relative position (0,0) there is object Magnet_Area_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Mag_L with subimage 0 and speed 1
else
if at relative position (0,0) there is object Dig_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if pressing_vertical is equal to 0
set the sprite to Char_Dig_L with subimage 0-15 and speed 1
else
if at relative position (0,0) there is object Water_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-2,0) is collision free for Only solid objects
jump relative to position (-2,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
else
if relative position (-2,-4) is collision free for Only solid objects
jump relative to position (-2,-4)
move in direction 270 at most -1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
Now with that code I move through the water and dig objects fine, but my character moves about three times faster when climbing left or moving left through the magnet area. When I put the code in other places (such as after the code for the water block object), other abilities are affected in similar ways.
Any help anyone could give would be hugely appreciated. I'm very open to suggestions on how to better structure my code too, because I'm guessing that's what's causing this. I'm still very much a novice as far as that goes. And of course, if you need more information I'd be happy to give it. Thanks!
Note: After posting this I realized that the indentation in the code denoting brackets doesn't show up in the post for some reason. Any ideas how to fix that?
Keyboard Event for Key: Left
if can_move is equal to 1
set variable previous_direction to 1
COMMENT: Run_speed 0
if global.run_speed is equal to 0
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed 1
else
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
COMMENT: Run_Speed 1
if global.run_speed is equal to 1
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed .5
else
if at relative position (0,0) there is object Dig_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if pressing_vertical is equal to 0
set the sprite to Char_Dig_L with subimage 0-15 and speed 1
else
if at relative position (0,0) there is object Water_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-2,0) is collision free for Only solid objects
jump relative to position (-2,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
else
if relative position (-2,-4) is collision free for Only solid objects
jump relative to position (-2,-4)
move in direction 270 at most -1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
This works fine. But when I try to add the actions in for the magnet, weird stuff starts happening. First, when I'm moving through the magnet area in-game, the character moves much faster than the code is telling him to (as far as I can tell, of course). Also, depending on where I insert the code, it affects different other movement attributes. Here's one attempt:
Keyboard Event for Key: Left
if can_move is equal to 1
set variable previous_direction to 1
COMMENT: Run_speed 0
if global.run_speed is equal to 0
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed 1
else
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
COMMENT: Run_Speed 1
if global.run_speed is equal to 1
if at relative position (0,0) there is object Ladder
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Climb_L with subimage 0-5 and speed .5
else
if at relative position (0,0) there is object Magnet_Area_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
set the sprite to Char_Mag_L with subimage 0 and speed 1
else
if at relative position (0,0) there is object Dig_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if pressing_vertical is equal to 0
set the sprite to Char_Dig_L with subimage 0-15 and speed 1
else
if at relative position (0,0) there is object Water_Block_Obj
if relative position (-1,0) is collision free for Only solid objects
jump relative to position (-1,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-1,-4) is collision free for Only solid objects
jump relative to position (-1,-4)
move in direction 270 at most 1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Walk_L with subimage 0-11 and speed 1
else
if relative position (-2,0) is collision free for Only solid objects
jump relative to position (-2,0)
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
else
if relative position (-2,-4) is collision free for Only solid objects
jump relative to position (-2,-4)
move in direction 270 at most -1 till a contact with solid objects
if relative position (0,1) gives a collision with Only solid objects
set the sprite to Char_Run_L with subimage 0-15 and speed 1
Now with that code I move through the water and dig objects fine, but my character moves about three times faster when climbing left or moving left through the magnet area. When I put the code in other places (such as after the code for the water block object), other abilities are affected in similar ways.
Any help anyone could give would be hugely appreciated. I'm very open to suggestions on how to better structure my code too, because I'm guessing that's what's causing this. I'm still very much a novice as far as that goes. And of course, if you need more information I'd be happy to give it. Thanks!
Warping between rooms?
04 April 2012 - 08:08 PM
Hi, I'm making a side-scrolling adventure game that consists of a number of large rooms, with the view following the player character inside those rooms. Everything outside the view of the character is deactivated.
I'm looking for a way to make it so that my character can 'warp' between rooms in the game whenever he's at a statue. So, if my character goes to statue A in room 1, i want him to warp to statue X in room 2. If he goes to statue B in room 1, I want him to warp to statue Y in room 2. The problem is, I don't know how to specifically tell the game where I want the character to end up when he moves between rooms. The program is probably confused too because I already have places where I've set the character inside these rooms. Can I find a way to not do this? I'm just very confused about this whole thing.
Here's what I've tried: In the "press a" event for the character it checks if there's a statue in front of him. If so, he warps to whatever room the statue corresponds to. I can get my character out of the main room fine with this method, he just warps to wherever I placed him in the next room. But when I try to warp back to the first room using the same method, the screen flashes between a bunch of different views before I see the character just falling through the blackness outside the game area.
Any help would be greatly appreciated, this is really stalling my progress!
A big problem
I'm looking for a way to make it so that my character can 'warp' between rooms in the game whenever he's at a statue. So, if my character goes to statue A in room 1, i want him to warp to statue X in room 2. If he goes to statue B in room 1, I want him to warp to statue Y in room 2. The problem is, I don't know how to specifically tell the game where I want the character to end up when he moves between rooms. The program is probably confused too because I already have places where I've set the character inside these rooms. Can I find a way to not do this? I'm just very confused about this whole thing.
Here's what I've tried: In the "press a" event for the character it checks if there's a statue in front of him. If so, he warps to whatever room the statue corresponds to. I can get my character out of the main room fine with this method, he just warps to wherever I placed him in the next room. But when I try to warp back to the first room using the same method, the screen flashes between a bunch of different views before I see the character just falling through the blackness outside the game area.
Any help would be greatly appreciated, this is really stalling my progress!
A big problem
Should I post my gmk file?
28 January 2012 - 06:02 PM
I'm definitely a novice, but I figured I should post here because my question is more about advice within the community. I'm having a big problem in my game, one that seems unsolvable by normal means, and is possibly just a problem with game maker itself. A few people suggested I post my gmk file so that others could figure out the problem.
Is this really a good idea? I've seen people in forums discussing how stupid this would be, but now people are telling me it's fine. I just don't know, I have no experience here. And I'm a bit desperate because my game literally can't progress if this isn't fixed.
Is this really a good idea? I've seen people in forums discussing how stupid this would be, but now people are telling me it's fine. I just don't know, I have no experience here. And I'm a bit desperate because my game literally can't progress if this isn't fixed.
- Game Maker Community
- → Viewing Profile: Topics: BoronBananez
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content