Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
(A) change vspeed to moving downward. then(B) if there is not a solid 40 pixels below the player, move down(vspeed=4) until we contact with a solid using 5 pixels per check at a time. then(C) if nothing is below the player and the user is pressing up key, move player up 40 pixels.
Though it works in A,B,C order you have to watch for looping concepts. The step event ends with (C) but then begins again at (A) so in a sense you can get a C, next step, A, B order
if (C) you are standing on a solid, then press up, you go up 40 pixels. In the next step, the script changes(A) the vspeed back to 4 and starts(B) to find a solid to move against because nothing is below the player.
EDIT: a possible solution is to take out the vspeed=4 line and replace it with something like
resources
article by YoYo on physics[www.yoyogames.com]
video by Shaun Spawlding on physics
video of basic physics with Heartbeast
video playlist on physics
if vspeed < 4 {vspeed += 1}
//walking
if keyboard_check(vk_left){if hspeed > -4 {hspeed = -4}}
if keyboard_check(vk_right){if hspeed < 4 {hspeed = 4}}
//collision + gravity <- i am proud of this part; it took me a long time to figure it out
if !place_empty(x, y+vspeed)
{
move_contact_solid(direction, 5);
vspeed = 0;
}
if !place_empty(x+hspeed, y)
{
move_contact_solid(direction, 5);
hspeed = 0;
}
//jumping
if keyboard_check_pressed(vk_up) and !place_empty(x,y+1)
{
vspeed = -16;
} //i'll tinker more with the numbers tomorrow
and it now works