Jump to content


ellisvlad

Member Since 13 Apr 2009
Offline Last Active Today, 10:32 AM

Posts I've Made

In Topic: Detecting Walls And Drawing Rotating Line

23 April 2013 - 03:26 PM

If you run through your Step code, as if you were explaining it to someone, you will probably spot your problem much easier,

 

Add the dirspeed to the direction

Then check every point on the line for a collision.

If there is a collition, set hit to true, otherwise, let it stay at false.

If there was no collision, reverse the dirspeed.

 

As you may notice, you are adding the dirspeed before doing collision checks, so the code is checking the position that the laser just moved into for collisions, and then taking action.Rather than checking if it should reverse before moving to the new position. There is a very simple way to remedy this.

 

When you check if there was a collision, at the end of the code, move the direction back to a place you know had a collision, from the checks that were run last step:

direction += dirspeed; //Add to direction
var hit=false; //Set a default hit=false
for(i=0;i<=dist;i+=1) //Check every point on the line (dist=200 in this case)
{
    xx = x + lengthdir_x(i,direction);
    yy = y + lengthdir_y(i,direction);
    if (collision_point(xx,yy,obj_box_parent,0,1)) //Check for collision
    {
        hit=true; //If we find a hit......
        break;
    }
}
if(hit==false)
{
    dirspeed=-dirspeed; //.....we change direction
    direction+=dirspeed; // Jump back to a direction that did have a collision
}

 

Your welcome, Vlad ;)


In Topic: Unknown Variable 'X'?

12 April 2013 - 12:15 PM

There are objects and instances, make sure you are refering to a particular instance of laser and circle, not just the object themselves.

e.g

l=instance_create(12, 34, laser)
show_message(string(l.x)+" "+string(l.y))

 

should do a message with "12 34"


In Topic: Steam for Game Maker

31 March 2013 - 12:01 PM

Yup, it's still alive :D I've been very busy recently with all kinds of stuff, but will be getting back to this in a few days ;) watch this space for a progress report ;)

In Topic: Zure System [Not Live Streaming Right Now]

21 March 2013 - 05:30 PM

*bump* ;)


In Topic: Name Of Creator Block Engine On Forum

12 March 2013 - 03:59 PM

I found the example block engine and want to know how the maker of engine block here on the forum called.

thanks


Can you link to where you found the engine? There are lots, which do you mean?