- Game Maker Community
- → Viewing Profile: Posts: ohaithar
ohaithar
Member Since 19 Mar 2012Offline Last Active May 17 2012 04:01 PM
Community Stats
- Group New Member
- Active Posts 150
- Profile Views 1127
- Member Title GMC Member
- Age 24 years old
- Birthday January 16, 1989
-
Gender
Male
-
Version
GM8
Posts I've Made
In Topic: Player Movement
20 April 2012 - 06:11 PM
Ill try both suggestions tomorrow, thanks
In Topic: Player Movement
19 April 2012 - 01:05 AM
Well, I can try giving a better code, but I'll need more information about your game and how you wnt him to move than.
It's a platformer.
I want him to move left and right, without acceleration. And jump, if you hold a key he jumps a little higher
In Topic: Player Movement
17 April 2012 - 09:36 PM
My character doesn't even move.. And i don't understand half of the code, at least the bottom part..
Some help?
EDIT : Well, it moves now, i had my friction too high. But still it's so weird, i don't need acceleration, maybe only jump acceleration. And my character usually just floats in obj_solid
Some help?
EDIT : Well, it moves now, i had my friction too high. But still it's so weird, i don't need acceleration, maybe only jump acceleration. And my character usually just floats in obj_solid
In Topic: Player Movement
17 April 2012 - 07:17 PM
Just wanted to put this in code, because it's hard to read.there are many different ways and none are good in all cases, but I'll give a way that is based on that your obj_solid actually is solid:
var(onground)=place_meeting(x,y,obj_solid); // LEFT if keyboard_check(vk_left)&&hspeed<=0{ if onground image_xscale=-1; hspeed-=ACCELERATION; } // RIGHT if keyboard_check(vk_right)&&hspeed>=0{ if onground image_xscale=1; hspeed+=ACCELERATION; } // FRICTION hspeed-=FRICTION*sign(hspeed); if abs(hspeed)<FRICTION hspeed=0; // JUMP if onground{ if keyboard_check(vk_up) vspeed=-JUMPPOWER; }else // GRAVITY vspeed+=WEIGHT; // COLLISION var(col_id)=instance_place(x+hspeed,y+vspeed,obj_solid); if col_id{ move_contact_solid(direction,speed); if x-sprite_xoffset+sprite_width<col_id.x-col_id.sprite_xoffset || x-sprite_xoffset>col_id.x-col_id.sprite_xoffset+col_id.sprite_width hspeed=0;else vspeed=0; }
Gonna try this soon..
In Topic: AI Movement
17 April 2012 - 03:06 PM
obj_enemy will return the values for the first instance of obj_enemy placed in the room, whereas the specific id is for a different obj_enemy. So from your image, the first image of obj_enemy you placed in the room happens to have an id of 102086. So the code you are using is working, but may be watching the wrong obj_enemy.
You are right.. i don't know how but there was another obj_enemy on the map
- Game Maker Community
- → Viewing Profile: Posts: ohaithar
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content

