[ 1 post ]  Reply to topicPost new topic 
Author Message
 [aq]
 Post subject: Make collisions using my own system
PostPosted: Fri Dec 10, 2010 10:45 pm 
User avatar
Obey.
Member
[*]
[*]
I'm making my own collision script, but I can't make the object I touched as an argument. I even tried to do it with one object but it won't work. Mario just falls through the ground.
Here's the code I used:
Script:
Code:
bleft = obj_solidground.bbox_left
btop = obj_solidground.bbox_top
bright = obj_solidground.bbox_right
bbottom = obj_solidground.bbox_bottom

if argument0 > bright
or argument3 < bleft
or argument1 > bbottom
or argument4 < btop
    return true;
else
    return false;


Mario step event
Code:
if col_rect(bbox_left,bbox_bottom,bbox_right,bbox_bottom+2)
and yspeed = 0
        if xspeed = 0
        state = 0
    else
        state = 1
else
    state = 2

y += yspeed
yspeed = min(yspeed+grav,4)

if col_rect(bbox_left,bbox_bottom,bbox_right,bbox_bottom+2)
    {
        topblock = collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+2,obj_solidground,1,1)
        if not yspeed < 0
            {
                y = topblock.bbox_top-31
                yspeed = 0
                grav = 0
                jumpnow = 0
            }
    }
else
    {
        if yspeed < -1
            grav = 0.1
        else
            grav = 0.3
    }


Help would greatly release my fangame early :D .

EDIT: Anyone help me?

_________________
I am your supreme leader
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
 [ 1 post ]  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