Go to page Previous  1 ... 37, 38, 39, 40, 41  [ 801 posts ]  Reply to topicPost new topic 
Coding Help, Questions and Issues relating to coding
Author Message
 [zz]
 Post subject: Re: Coding Help
PostPosted: Wed Feb 15, 2017 6:53 pm 
User avatar
Member
I solved the problem

I forgot to account the Horizontal speed of the player when checking for collision.

Code:
//Horizontal Collision
slope_max = 10
if !place_meeting(x+sign(Hsp),y,Solid)
{
 for (cd=0;!place_meeting(x+Hsp,y+cd,Solid) && cd<=abs(slope_max);cd+=1;)
 {
   if !place_meeting(x+Hsp,y+cd,Solid) and place_meeting(x+(Hsp),y+slope_max,Solid)//Right Here
   y+=cd;
 }

}

if place_meeting(x+Hsp,y,Solid)
{
    cu = 0;
    while ((place_meeting(x+Hsp,y-cu,Solid) && cu <= abs(slope_max))) cu += 1;
    if place_meeting(x+Hsp,y-cu,Solid)
    {
        while (!place_meeting(x+sign(Hsp),y,Solid)) x+=sign(Hsp);
        Hsp = 0;
    }
    else
    {
        y-=cu;
    }
}

x += Hsp;


Kinda knew it was something as simple as that ><
Hills now behave almost exactly like they did in Yoshi's Island :P

 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
Go to page Previous  1 ... 37, 38, 39, 40, 41  [ 801 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 1 guest


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
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group