Jump to content


General Leo

Member Since 06 Dec 2003
Offline Last Active Apr 28 2013 07:29 PM

Topics I've Started

using math to spread out objects evenly

20 May 2012 - 07:03 PM

Anybody really good at math? I need help with the mathmatics behind creating objects between two points and spacing them out evenly depending on the total distance. So my game is a space game and I made a Build_Tradelane script that takes the x and y values of one position and the radius of the planet (basically offset of the planets x and y values) then the other planet's x,y,and radius. Then it takes those numbers and attempts to create tradelane rings at a distance of around 1000 from eachother.

The problem is, I want the beginning and ending tradelane rings to be a set distance from the planet so the middle rings can be a little more or a little less then 1000 from eachother. I'm not sure how I can program that into my script. I hope you can understand this... it's a bit hard to explain.

Here's what I have sofar... Right now it works but I'm in the middle of adding the radius parts so keep the rings outside of the planets themselves.
//BuildTradelane(x1,y1,radius1,x2,y2,radius2)

DistanceTotal=point_distance(argument0, argument1, argument3, argument4);
BuildAmount = floor(DistanceTotal/1000)


for (bld=1; bld<BuildAmount; bld+=1)
{
if bld=1
tdln=instance_create(argument0+lengthdir_x(1000*bld,point_direction(argument0, argument1, argument3, argument4)),argument1+lengthdir_y(1000*bld,point_direction(argument0, argument1, argument3, argument4)),o_TradelaneR)
else 
  {if bld=BuildAmount
  tdln=instance_create(argument0+lengthdir_x(1000*bld,point_direction(argument0, argument1, argument3, argument4)),argument1+lengthdir_y(1000*bld,point_direction(argument0, argument1, argument3, argument4)),o_TradelaneL)
    else
    tdln=instance_create(argument0+lengthdir_x(1000*bld,point_direction(argument0, argument1, argument3, argument4)),argument1+lengthdir_y(1000*bld,point_direction(argument0, argument1, argument3, argument4)),o_TradelaneM)}
tdln.dir=point_direction(argument0, argument1, argument3, argument4)
bld+=1
}


Anybody wanna take a crack at helping me with this?

Found a bug...

20 May 2012 - 01:17 AM

"Range check error"

I get the above message when opening my main room in my game. I realize the room is large (999,999) but it's required for my game type/style. When I click ok and click the "settings" tab, I get the following error message...

Access violation at address 00462A68 in module 'Game_Maker.exe'.
Read of address 0000002C.


Does anybody have any information on this? Any idea how to fix it? Anytime I change the room size it just gives me the Range check error again and again.

quick code help

21 September 2011 - 06:36 PM

while string_char_at(Data[i,1],string_length(Data[i,1])) = " "
Data[i,1]=string_copy(Data[i,1],1,string_length(Data[i,1])-1)

I'm trying to remove trailing spaces from Data[i,1] but for some reason, before and after both have spaces... Am I missing something?

Adjust window size and view

19 September 2011 - 05:50 PM

Can anybody help me find out what I'm doing wrong? I made a tiny bar at the top of my screen which searches a webpage quickly and returns information from it by "dropping down" the window and listing the info. Right now I have a room and the "quick bar" is set in a view so the window starts small. After you search, I have this...
window_set_size(window_get_width(),window_get_height()+1)
view_hview[0]=view_hview[0]+1
view_hport[0]=view_hport[0]+1
here's a screenshot of the quick bar:
Posted Image
What the "dropped down" bar SHOULD look like: (this is also the full room)
Posted Image
What the "dropped down" bar looks like now:
Posted Image

As you can see it looks like the window is larger then the view but in debug mode, it shows hview and hport are both the height of the room... I don't understand why there's still black around it when the background color of the room is gray and also why the bar is centered instead of on top where it lays in the room. I'm guessing I'm missing something with the views?

Best way to organize files/folders?

26 August 2011 - 08:07 PM

Does anybody know the best way (or anyway that works) that I can rename, move, copy...etc files and folders? My game uses a directory on my computer (NOT in the same directory as the game since I edit all my games on my desktop. please don't tell me to use a shortcut either...) This directory has a bunch of directories and files in it and I want my game to keep them organized and formatted correctly and make fixes as necessary.

How can I rename, copy, delete, get file last modification dates...etc with Game Maker? I looked for a dll but can't find anything that would work. I saw one other topic where the person was using file_copy to move files into the directory, modify them, then copy them back but is this the only way to do this?