Jump to content


ellisvlad

Member Since 13 Apr 2009
Offline Last Active Feb 25 2014 01:41 PM

Posts I've Made

In Topic: The Great Gmc Jam #11 Discussion Topic

27 July 2013 - 02:46 AM

Ahh, haven't used Game Maker in so long, let's hope I can make something decent by the end of the Jam ;)

 

For anyone still trying to find an idea, Just write random things to do with monsters on paper, or in notepad, and just develop the idea, even if you won't use it :P You're more likely to think of something good if you are in a monster-game theme mindset.. I did this, and while I'm not using alot of these ideas, it helped me think of the idea I am using ;)

 

Spoiler


In Topic: Count To 7500 By End Of July!

08 June 2013 - 10:36 AM

5441


In Topic: Count To 7500 By End Of July!

02 June 2013 - 02:49 PM

5318


In Topic: How To Set All Values In An Array

27 May 2013 - 08:36 PM

The best way would be to loop through all the values of the array, however, GM arrays are initialised to 0 by default when using the standard array initialisation syntax. (inventory[10]=0;) Also, may I recommend my Inventory Example for GM8.0 . It is still working in the latest version. http://host-a.net/u/...(inventory).gmk


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 ;)