GameMaker Studio 2 Desktop

GameMaker Studio 2 Desktop

Broku Mar 4, 2019 @ 9:05am
Getting caught on my wall objects
I need some help. I'm developing my first room right now for testing but for some reason whenever I walk up to a wall to see how well the collision effect works, I stop like I'm supposed to, but I also get caught and can't move at all. several times the test will freeze and I have to repress the test run button to get out of it

I just need someone to look over the script I made to see if I did anything wrong, or if I'm missing something
https://steamcommunity.com/sharedfiles/filedetails/?id=1673194400&fileuploadsuccess=1

Any help will be appreciated
< >
Showing 1-11 of 11 comments
forwardresent Mar 4, 2019 @ 10:23am 
In your horizontal collision in the if statement you are checking y+=hsp. Does changing that fix your issue?
maras Mar 4, 2019 @ 10:24am 
In line 18 you wrote: if place_meeting(x+hspd, y+hspd, oWall)
Broku Mar 4, 2019 @ 10:59am 
Originally posted by Forward Resent:
In your horizontal collision in the if statement you are checking y+=hsp. Does changing that fix your issue?

No. now when I walk into a wall, I get stuck entirely

Here's the tutorial I've been following
https://youtu.be/evkFHHNp0-Q

I'm still pretty new to coding. I have very little experience
maras Mar 4, 2019 @ 11:06am 
13:05 "It's very easy to mess this up"
You wrote
if place_meeting(x+hspd, y+hspd, oWall)
instead of
if place_meeting(x+hspd, y, oWall)

EDIT
and also you have
x+sign(vspd)
instead of
y+sign(vspd)

So just check again the collision part
Last edited by maras; Mar 4, 2019 @ 11:08am
forwardresent Mar 4, 2019 @ 11:53am 
Your while(!place_meeting) in the vertical collision check is also incorrect, should be
if (!place_meeting(x, y+sign(vsp), oWall1)

I recommend you check out this tutorial series and other tutorials by Shaun Spaulding on his youtube channel.

https://www.youtube.com/watch?v=izNXbMdu348
Broku Mar 4, 2019 @ 12:09pm 
Originally posted by marasovec:
13:05 "It's very easy to mess this up"
You wrote
if place_meeting(x+hspd, y+hspd, oWall)
instead of
if place_meeting(x+hspd, y, oWall)

EDIT
and also you have
x+sign(vspd)
instead of
y+sign(vspd)

So just check again the collision part

I've updated the script but I'm still getting caught on the walls

https://steamcommunity.com/sharedfiles/filedetails/?id=1673373662&fileuploadsuccess=1
forwardresent Mar 4, 2019 @ 12:44pm 
Are you getting immediately stuck as soon as you collide? Or are you just getting stuck on odd collisions like corners?
Last edited by forwardresent; Mar 4, 2019 @ 12:49pm
Broku Mar 4, 2019 @ 12:48pm 
Originally posted by Forward Resent:
Are you getting immediately stuck as soon as you collide? Or are you just getting stuck on odd collisions like corners?

Both. I'm getting stuck as soon as I touch, and in corners
maras Mar 4, 2019 @ 1:29pm 
How about collision masks? Do all of the player sprites have the same size of collision masks and the same origin?
Last edited by maras; Mar 4, 2019 @ 1:29pm
forwardresent Mar 4, 2019 @ 1:33pm 
if (place_meeting(x + hspd, y, obj_wall)) {
while (!place_meeting(x+sign(hspd), y, obj_wall)) {
x += sign(hspd);
}
hspd = 0;
}

x += hspd;

I ran your collision code (above) with the corrections and collisions work fine, so I think your problem is with your movement code as I did not replicate movement as in the tutorial. Please recheck your movement code matches the tutorial you are following. I really recommend the tutorial series I posted above as a first project. Shaun used to work for yoyogames, knows a lot of stuff and best of all how to explain it well.
Last edited by forwardresent; Mar 4, 2019 @ 1:34pm
Broku Mar 4, 2019 @ 6:31pm 
Originally posted by Forward Resent:
if (place_meeting(x + hspd, y, obj_wall)) {
while (!place_meeting(x+sign(hspd), y, obj_wall)) {
x += sign(hspd);
}
hspd = 0;
}

x += hspd;

I ran your collision code (above) with the corrections and collisions work fine, so I think your problem is with your movement code as I did not replicate movement as in the tutorial. Please recheck your movement code matches the tutorial you are following. I really recommend the tutorial series I posted above as a first project. Shaun used to work for yoyogames, knows a lot of stuff and best of all how to explain it well.

The only problem with that is I can't find any videos by Shaun relating to what I'm trying to do. I want to make a RPG type of game like Final Fantasy or Undertale with a turn base strategy battle system. but whenever I type in Shaun RPG or Shaun Turn Base, I'm lead to another YouTuber

The video you showed me was the first video I watched when I started, but my game isn't going to be purely side scroller. my avatar is going to walk up, down, left, and right instead of just side to side, like older RPG games. so far I've been able to make the character move in all directions, he just gets stuck when touching walls

Thanks, but I'm gonna stay with the tutorial I'm watching now
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Mar 4, 2019 @ 9:05am
Posts: 11