Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Character collision with additional walls GML
Post Flair (click to view more posts with a particular flair)
Post Body

Hi.

Running into an issue that I cant find a fix for :( The problem is I have two objects, a wall and the character but I want to add another wall and am having issues with the code for collisions, I need to make it so that my character acts the same when colliding with either of the two walls wall but not sure what to add in the code to achieve this. I am still new so this might even be a noob question :)

Current character code (using a step):

//Get the player's input key_right = keyboard_check (vk_right) ; key_left = -keyboard_check (vk_left) ; key_jump = keyboard_check_pressed (vk_space) ;

//React to inputs move = key_left key_right; hsp = move * movespeed; if (vsp < 10) vsp = grav;

if (place_meeting(x,y 1,obj_wall)) { vsp = key_jump * -jumpspeed }

//Horizontal Collision if (place_meeting(x hsp,y,obj_wall)) { while(!place_meeting(x sign(hsp),y,obj_wall)) { x = sign(hsp); } hsp = 0; } x = hsp;

//Vertical Collision if (place_meeting(x,y vsp,obj_wall)) { while(!place_meeting(x,y sign(vsp),obj_wall)) { y = sign(vsp); } vsp = 0; } y = vsp;

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
725
Link Karma
658
Comment Karma
10
Profile updated: 1 week ago
Posts updated: 1 day ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 years ago