Check if vspeed > 0, if true, set the sprite to your falling sprite. Simple as that.
Thanks Quo
[quote="[url=http://phpbb.mfgg.net/viewtopic.php?p=375085#p375085]Quotient[/url]"]Check if vspeed > 0, if true, set the sprite to your falling sprite. Simple as that.[/quote]
Thanks Quo
_________________
Spoiler:
Quote:
-_- why i turned like my enemy?
Mit wrote:
Just what is the deal with Paper Mario? I mean really! You've got these huge sprites, all this shading, it's a wonder it doesn't crash the game! Just how do they do it? Really!
DarkBlueYoshi wrote:
Also, it's a 4-bit sprite, not 16-bit in the SNES.
How do you make a Bill Blaster detect whether Mario (or Luigi) is to its left or right?
DnD, please. (Standard edition)
Another question...
How do you make a Bill Blaster detect whether Mario (or Luigi) is to its left or right?
DnD, please. (Standard edition)
_________________
Spoiler:
Quote:
-_- why i turned like my enemy?
Mit wrote:
Just what is the deal with Paper Mario? I mean really! You've got these huge sprites, all this shading, it's a wonder it doesn't crash the game! Just how do they do it? Really!
DarkBlueYoshi wrote:
Also, it's a 4-bit sprite, not 16-bit in the SNES.
You can center the sprite x or use this: if obj_player.x > x+sprite_width/2 { //the right facing! Place your code here... } else { //Left facing! Your code goes here... }
You can center the sprite x or use this:
if obj_player.x > x+sprite_width/2
{
//the right facing! Place your code here...
}
else
{
//Left facing! Your code goes here...
}
_________________
Please contact me for any broken links below. Spoiler:
//--Creation Event-- //Variable Initialization facing=0;alarm[0]=60;//Change alarm number if needed
//--Alarm[0] Event-- if obj_player.x>=self.x{facing=-1;} else if obj_player.x<=self.x+16{facing=1;} else if obj_player.x<=self.x && obj_player.x >=self.x+16{facing=0;} if facing=0{alarm[0]=60;exit;} else if facing!=0{ii=instance_create(x,y,obj_bullet);ii.hspeed=2*facing;ii.type=1/*used for if you want to have a homing bill or not*/} alarm[0]=60;
just substitute obj_player with what ever the player parent is. and substitute obj_bulet for what ever the bullet bill object's name is.
This isn't in DnD because DnD is extremely inefficient and can take more time than needed.
or you could do this:
[code]
//--Creation Event--
//Variable Initialization
facing=0;alarm[0]=60;//Change alarm number if needed
//--Alarm[0] Event--
if obj_player.x>=self.x{facing=-1;}
else if obj_player.x<=self.x+16{facing=1;}
else if obj_player.x<=self.x && obj_player.x >=self.x+16{facing=0;}
if facing=0{alarm[0]=60;exit;}
else if facing!=0{ii=instance_create(x,y,obj_bullet);ii.hspeed=2*facing;ii.type=1/*used for if you want to have a homing bill or not*/}
alarm[0]=60;
[/code]
just substitute obj_player with what ever the player parent is.
and substitute obj_bulet for what ever the bullet bill object's name is.
This isn't in DnD because DnD is extremely inefficient and can take more time than needed.
//--Creation Event-- //Variable Initialization facing=0;alarm[0]=60;//Change alarm number if needed
//--Alarm[0] Event-- if obj_player.x>=self.x{facing=-1;} else if obj_player.x=self.x+16{facing=0;} if facing=0{alarm[0]=60;exit;} else if facing!=0{ii=instance_create(x,y,obj_bullet);ii.hspeed=2*facing;ii.type=1/*used for if you want to have a homing bill or not*/} alarm[0]=60;
just substitute obj_player with what ever the player parent is. and substitute obj_bulet for what ever the bullet bill object's name is.
This isn't in DnD because DnD is extremely inefficient and can take more time than needed.
crap I'm making my platformer in DnD
My engine isn't really buggy though - just one graphics glitch.
Thanks anyway
[quote="[url=http://phpbb.mfgg.net/viewtopic.php?p=375372#p375372]Shadow Kami[/url]"]or you could do this:
[code]
//--Creation Event--
//Variable Initialization
facing=0;alarm[0]=60;//Change alarm number if needed
//--Alarm[0] Event--
if obj_player.x>=self.x{facing=-1;}
else if obj_player.x=self.x+16{facing=0;}
if facing=0{alarm[0]=60;exit;}
else if facing!=0{ii=instance_create(x,y,obj_bullet);ii.hspeed=2*facing;ii.type=1/*used for if you want to have a homing bill or not*/}
alarm[0]=60;
[/code]
just substitute obj_player with what ever the player parent is.
and substitute obj_bulet for what ever the bullet bill object's name is.
This isn't in DnD because DnD is extremely inefficient and can take more time than needed.[/quote]
crap I'm making my platformer in DnD :(
My engine isn't really buggy though - just one graphics glitch.
Thanks anyway
_________________
Spoiler:
Quote:
-_- why i turned like my enemy?
Mit wrote:
Just what is the deal with Paper Mario? I mean really! You've got these huge sprites, all this shading, it's a wonder it doesn't crash the game! Just how do they do it? Really!
DarkBlueYoshi wrote:
Also, it's a 4-bit sprite, not 16-bit in the SNES.
I'm trying to animate my character so when he stops moving he goes back to standing. Only problem is when you release the 'D' key (going right) he changes to standing. but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code. Spoiler:
{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last sprite_index = spr_player // Set to still sprite image_index = 0 // Set player to face RIGHT } else { if keyboard_check_released(ord('A')) // if A was released last sprite_index = spr_player //Set to still sprite image_index = 1 // Set player to face LEFT } }
I'm trying to animate my character so when he stops moving he goes back to standing.
Only problem is when you release the 'D' key (going right) he changes to standing.
but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code.
[spoiler]{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last
sprite_index = spr_player // Set to still sprite
image_index = 0 // Set player to face RIGHT
}
else
{ if keyboard_check_released(ord('A')) // if A was released last
sprite_index = spr_player //Set to still sprite
image_index = 1 // Set player to face LEFT
}
}[/spoiler]
I'm trying to animate my character so when he stops moving he goes back to standing. Only problem is when you release the 'D' key (going right) he changes to standing. but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code. Spoiler:
{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last sprite_index = spr_player // Set to still sprite image_index = 0 // Set player to face RIGHT } else { if keyboard_check_released(ord('A')) // if A was released last sprite_index = spr_player //Set to still sprite image_index = 1 // Set player to face LEFT } }
Well the problem is that you simply made it change it's frame.
Before I give you some help on it, what are you trying to accomplish with it, a description on how it walks and such would be helpful. So I know what your trying to do.)
[quote="Farlon303"]I'm trying to animate my character so when he stops moving he goes back to standing.
Only problem is when you release the 'D' key (going right) he changes to standing.
but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code.
[spoiler]{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last
sprite_index = spr_player // Set to still sprite
image_index = 0 // Set player to face RIGHT
}
else
{ if keyboard_check_released(ord('A')) // if A was released last
sprite_index = spr_player //Set to still sprite
image_index = 1 // Set player to face LEFT
}
}[/spoiler][/quote]
Well the problem is that you simply made it change it's frame.
Before I give you some help on it, what are you trying to accomplish with it, a description on how it walks and such would be helpful. So I know what your trying to do.)
I'm trying to animate my character so when he stops moving he goes back to standing. Only problem is when you release the 'D' key (going right) he changes to standing. but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code. [spoiler]{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last sprite_index = spr_player // Set to still sprite image_index = 0 // Set player to face RIGHT } else { if keyboard_check_released(ord('A')) // if A was released last sprite_index = spr_player //Set to still sprite image_index = 1 // Set player to face LEFT } }
Well the problem is that you simply made it change it's frame.
Before I give you some help on it, what are you trying to accomplish with it, a description on how it walks and such would be helpful. So I know what your trying to do.)[/spoiler]
Well it's a platforming character who moves left and right so (as I wanted) when you press the 'D' key he moves to the right and changes to an animated sprite. And it's the same with the left movement.
I want it so when the character stops moving he changes from his walking sprite back to his standing still sprite. Now when 'D' is released and the character stops moving he changes back to his standing sprite but when 'A' is released he stops moving but stays in the walking left sprite.
[quote="Shadow Kami"][spoiler][quote="Farlon303"]I'm trying to animate my character so when he stops moving he goes back to standing.
Only problem is when you release the 'D' key (going right) he changes to standing.
but when you release the 'A' key (going left) he does animate but stays in the walk sprite.
Here's the code.
[spoiler]{if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{ if keyboard_check_released(ord('D')) // If D was released last
sprite_index = spr_player // Set to still sprite
image_index = 0 // Set player to face RIGHT
}
else
{ if keyboard_check_released(ord('A')) // if A was released last
sprite_index = spr_player //Set to still sprite
image_index = 1 // Set player to face LEFT
}
}[/spoiler][/quote]
Well the problem is that you simply made it change it's frame.
Before I give you some help on it, what are you trying to accomplish with it, a description on how it walks and such would be helpful. So I know what your trying to do.)[/spoiler][/quote]
Well it's a platforming character who moves left and right so (as I wanted) when you press the 'D' key he moves to the right and changes to an animated sprite. And it's the same with the left movement.
I want it so when the character stops moving he changes from his walking sprite back to his standing still sprite.
Now when 'D' is released and the character stops moving he changes back to his standing sprite but when
'A' is released he stops moving but stays in the walking left sprite.
That code doesn't make much sense - that "else" is taking into consideration only the very first line. Try moving the ifs that are inside braces to be just outside them, like so:
Code:
if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed. { if keyboard_check_released(ord('D')) // If D was released { sprite_index = spr_player // Set to still sprite image_index = 0 // Set player to face RIGHT } else if keyboard_check_released(ord('A')) // if A was released { sprite_index = spr_player //Set to still sprite image_index = 1 // Set player to face LEFT } }
I can still see this acting kind of funky but this should fix the immediate issue.
That code doesn't make much sense - that "else" is taking into consideration only the very first line. Try moving the ifs that are inside braces to be just outside them, like so:
[code]if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{
if keyboard_check_released(ord('D')) // If D was released
{
sprite_index = spr_player // Set to still sprite
image_index = 0 // Set player to face RIGHT
}
else if keyboard_check_released(ord('A')) // if A was released
{
sprite_index = spr_player //Set to still sprite
image_index = 1 // Set player to face LEFT
}
}[/code]
I can still see this acting kind of funky but this should fix the immediate issue.
_________________
"talk about dang ol' this ain't scientific rockets, man" Spoiler:
That code doesn't make much sense - that "else" is taking into consideration only the very first line. Try moving the ifs that are inside braces to be just outside them, like so:
Code:
if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed. { if keyboard_check_released(ord('D')) // If D was released { sprite_index = spr_player // Set to still sprite image_index = 0 // Set player to face RIGHT } else if keyboard_check_released(ord('A')) // if A was released { sprite_index = spr_player //Set to still sprite image_index = 1 // Set player to face LEFT } }
I can still see this acting kind of funky but this should fix the immediate issue.
Worked like a charm! Thanks a bunch
[quote="Miles"][spoiler]That code doesn't make much sense - that "else" is taking into consideration only the very first line. Try moving the ifs that are inside braces to be just outside them, like so:
[code]if !keyboard_check(ord('A')) && !keyboard_check(ord('D')) && !keyboard_check(ord('W')) // Checks if A, D and W aren't being pressed.
{
if keyboard_check_released(ord('D')) // If D was released
{
sprite_index = spr_player // Set to still sprite
image_index = 0 // Set player to face RIGHT
}
else if keyboard_check_released(ord('A')) // if A was released
{
sprite_index = spr_player //Set to still sprite
image_index = 1 // Set player to face LEFT
}
}[/code]
I can still see this acting kind of funky but this should fix the immediate issue.[/spoiler][/quote]
Worked like a charm! Thanks a bunch :D
I'm not sure if this is coding, but I still need help with it.
A screen of my fangame imitates a DS. The size of the view is 320x480. I'm trying to get the character on the top screen to stay on the top screen. Right now, he is going into the bottom screen and behind an object due to depths, making him no longer visible. Help?
I'm not sure if this is coding, but I still need help with it.
A screen of my fangame imitates a DS. The size of the view is 320x480. I'm trying to get the character on the top screen to stay on the top screen. Right now, he is going into the bottom screen and behind an object due to depths, making him no longer visible. Help?
Here's more info:
View in room:
X - 0
Y - 0
W - 340
H - 480
Port on screen:
X - 0
Y - 0
W - 340
H - 480
Object following:
(player character)
Hbor - 320
Vbor - 160
Hsp - -1
Vsp - -1
Can't you set the first (top-view) on the player and the second (bottom-view) on a certain position in the room? For example, you say the player is not supposed to be able to appear on the bottom-view, so why not set the bottom-view's (x,y) in a place in the room where the player cannot reach (x,y) = (0,0) and have the actual level appear else where.
Can't you set the first (top-view) on the player and the second (bottom-view) on a certain position in the room? For example, you say the player is not supposed to be able to appear on the bottom-view, so why not set the bottom-view's (x,y) in a place in the room where the player cannot reach (x,y) = (0,0) and have the actual level appear else where.
Just make a Sprite for the player jumping in the first frame and in the second frame the one that shows him falling. Then add the code:
Code:
if keyboard_press(*insert jump button*) { *insert jumping code* jump = 1 } if jump = 1 { if vspeed < 0 image_index = 0 else image_index = 1 }
Don't forgot to do the "jump" variable turns into 0 when player lands in ground!
Just make a Sprite for the player jumping in the first frame and in the second frame the one that shows him falling.
Then add the code:
[code]if keyboard_press(*insert jump button*)
{
*insert jumping code*
jump = 1
}
if jump = 1
{
if vspeed < 0
image_index = 0
else
image_index = 1
}
[/code]
Don't forgot to do the "jump" variable turns into 0 when player lands in ground!
_________________
Please contact me for any broken links below. Spoiler:
For anyone with Xbox Controller experience with Game Maker:
I am adding in Xbox Controller support to my game, but I have situations where I'm substituting joystick_check_button(id,button) for keyboard_check_pressed() but joystick_check_button(x,y) acts like keyboard_check(). Does anyone have a solution to having it act like keyboard_check_pressed()?
For anyone with Xbox Controller experience with Game Maker:
I am adding in Xbox Controller support to my game, but I have situations where I'm substituting joystick_check_button(id,button) for keyboard_check_pressed() but joystick_check_button(x,y) acts like keyboard_check(). Does anyone have a solution to having it act like keyboard_check_pressed()?
Have a bunch of control variables in your object. Let's say ControlA is the A button.
Code:
if joystick_check_button(1,1) ControlA=min(2,ControlA+1);else if ControlA>0 ControlA=-1;else ControlA=0;
If it's equal to 1, it was just pressed. If it's 1 or more, it is being held. If it's -1, it was just released. If it's 0, it hasn't been pressed lately.
Have a bunch of control variables in your object. Let's say ControlA is the A button.
[code]if joystick_check_button(1,1) ControlA=min(2,ControlA+1);else if ControlA>0 ControlA=-1;else ControlA=0;[/code]
If it's equal to 1, it was just pressed. If it's 1 or more, it is being held. If it's -1, it was just released. If it's 0, it hasn't been pressed lately.
Last edited by Miles on Sun May 19, 2013 1:32 am, edited 1 time in total.
updated because oops
_________________
"talk about dang ol' this ain't scientific rockets, man" Spoiler:
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