ENIGMA Development Environment

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - RetroX

Pages: « 1 2 3 4 5
61
Tips, Tutorials, Examples / Fancy Collision Script
« on: November 16, 2008, 07:00:04 PM »
This is a script that will move the object into a free position in the best way possible.  Simple, yet effective.
Code: [Select]
// Syntax: collision_free(max)
// Function: Moves at a maximum of "max" outside of solids.

// Define Vars
left=0;
right=0;
up=0;
down=0;

// Don't do anything if we're already collision free
if not place_free(x,y)
{
// Check to see which way is closest to get outside of a solid
for (i=0;i<=argument0;i+=1;)
{
if place_free(x-i,y)
{
// Find out how far we can move left
left=i;
break;
}
}
for (i=0;i<=argument0;i+=1;)
{
if place_free(x+i,y)
{
// Find out how far we can move right
right=i;
break;
}
}
for (i=0;i<=argument0;i+=1;)
{
if place_free(x,y-1)
{
// Find out how far we can move up
up=i;
break;
}
}
for (i=0;i<=argument0;i+=1;)
{
if place_free(x,y+1)
{
// Find out how far we can move down
down=i;
break;
}
}
}

// If up is the highest, move up
if up>=left or up>=right or up>=down
{
y-=up;
}

// If down is the highest, move down
if down>=left or down>=right or down>=up
{
y+=down;
}

// If left is the highest, move left
if left>=right or left>=up or left>=down
{
x-=left;
}

// If right is the highest, move right
if right>=left or left>=up or left>=down
{
x+=right;
}

62
Tips, Tutorials, Examples / show_message()
« on: November 04, 2008, 01:23:48 PM »
Here's an alternate for show_message():
Code: [Select]
cpp { #include <windows.h>
MessageBox(argument0,"Message",MB_OKAY); }

63
General ENIGMA / Alternate to cpp {}
« on: October 25, 2008, 08:37:33 PM »
Wouldn't it be better to make the cpp {} statement into something like cpp <>?  For example, I could not do something like this:
cpp {
if (somecode)
{
}

ENIGMA_function();

cpp {
}
}

While I could like this:
cpp <
if (somecode)
{
>

ENIGMA_function();

cpp <
}
>

Just a suggestion.  This is used in PHP very often, and I think ENIGMA's C++ should act the same way.

64
Tips, Tutorials, Examples / choose(), mean(), median()
« on: October 08, 2008, 05:57:05 PM »
Well, I've looked at a C++ tutorial, and decided to finish up the math functions.

WARNING: I have not tested this, although I am pretty sure it will work.

First, go to fnames.txt and add the following to the bottom of the file:
int choose(int arg1, int arg2, ...)
int mean(int arg1, int arg2, ...)
int median(int arg1, int arg2, ...)

Now, go to GMmathnc.h in ENIGMAsystem/SHELL/Universal_System and add this to the bottom of the file:
// May not be necessary; just in case ENIGMA doesn't include them already
#include <stdarg.h>

int choose(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int array[];
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
array[j]=i;
j+=1;
}
va_end(ap);
return array[random(j)];
}

int mean(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int total=0;
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
total+=i;
j+=1;
}
va_end(ap);
}

int median(int num1, int num2, ...)
{
va_list choices;
int i;
int j=0;
int array[];
va_start(choices,num1);
for (i=arg1;i!=-1;i=va_arg(choices,int))
{
array[j]=i;
j+=1;
}
va_end(ap);
return array[(int)((j-1)/2)];
}

- The above functions only work with integers (no decimals/fractions).
- While they may not work in the setup I have provided, I am very positive that the scripts will work, and Josh may feel free to implement these into R4.

65
General ENIGMA / R3.5
« on: October 07, 2008, 06:27:18 PM »
I know Josh had a few troubles, and school's back, but I want sounds, colligma, possibly surfaces, and some form of sprite_set_alpha_from_sprite() so I can make some awesome games.  If someone knows of a way to do that in R3 with C++, please point it out, or else make R3.5.  Joshy is in need, help him out.

66
General ENIGMA / Source Generator?
« on: September 13, 2008, 04:09:01 PM »
Curious... but would it be possible to have an option to output the C++ source generated so we can modify it if we want before compiling it?  I was curious, and it probably wouldn't be hard considering ENIGMA generates the source anyways before compiling.

67
Tips, Tutorials, Examples / move_contact_solid();
« on: August 10, 2008, 09:56:37 PM »
Here's a temporary solution:
Code: [Select]
var i, error, x2, y2;
i=0;
error=false;
x2=x;
y2=y;
{
if i<=argument1
{
i+=1;
}
else
{
return false;
error=true;
break;
}
}
if error=false
{
x=x2;
y=y2;
}

68
Issues Help Desk / move_contact_solid()
« on: August 09, 2008, 02:52:41 PM »
Could someone make an alternate for me?  I'm clueless on how to do it.  It'll probably be easy to do, but ENIGMA doesn't support it yet.

69
« on: August 09, 2008, 10:18:53 AM »
Here's how you can recreate it, since it isn't done yet:
Code: [Select]
// Adds a set motion to the current motion

// Calculate where the object would travel at the different speeds

// Add up the two coordinates
x3=x1+x2;
y3=y1+y2;

// Set the new speed to the distance to the new coordinates
speed=point_distance(0,0,x3,y3);

// Find out what direction the new coordinates are from our position
direction=point_direction(0,0,x3,y3);

I believe that should work.

70
General ENIGMA / R3
« on: August 08, 2008, 10:41:17 AM »
When exactly will it be released?  The video said "8.8.08", and, well... it's the release date.  Gimme ENIGMA NAO.

71
General ENIGMA / Array Sizes?
« on: June 21, 2008, 08:37:23 PM »
This is just a simple suggestion: will ENIGMA have a function for determining array sizes (similar to the PHP sizeof() function)?  Just curious, because GM's been bugging me with that for some time.

72
General ENIGMA / GMPhysics in ENIGMA?
« on: June 17, 2008, 07:30:34 PM »
Once the DLL functions are added, will we be able to use GMPhysics like GM?  I've been wondering, since the DLL does the work, and it simply changes the x, y, and image_angle.

73
Tips, Tutorials, Examples / A Few Alternate Functions
« on: June 11, 2008, 04:37:05 PM »
Here are a few functions I made in GML to be used as alternates to not-done-yet functions.  Most are pretty simple, but hey.
frac(x)
argument0=string(argument0);
for (i=string_length(argument0);i>0;i+=1;)
{
if string_char_at(i+1)!='.' then
{
array[i]=string_char_at(i);
}
else
{
array[i]='0';
}
}
string='';
for (i=0;i<string_length(argument0);i+=1;)
{
string+=array[i];
}

return real(string);

draw_point(x,y)
draw_line(argument0,argument1,argument0,argument1);

draw_triangle(x1,y1,x2,y2,x3,y3,outline)
if argument6=true then pr_type=pr_linestrip else pr_type=pr_trianglelist;
draw_primitive_begin(pr_type);
draw_vertex(argument0,argument1);
draw_vertex(argument2,argument3);
draw_vertex(argument4,argument5);
if pr_type=pr_linestrip then draw_vertex(argument0,argument1);
draw_primitive_end();

draw_arrow(x1,y1,x2,y2,size);
draw_line(argument0,argument1,argument2,argument3);
draw_primitive_begin(pr_trianglelist);
draw_vertex(argument2,argument3);
draw_vertex(x2,y2);
draw_vertex(x3,y3);
draw_vertex(argument2,argument3);
draw_primitive_end();

draw_point_color(x,y,col1)
col=draw_get_color();
draw_set_color(argument2);
draw_line(argument0,argument1,argument0,argument1);
draw_set_color(col);

draw_triangle_color(x1,y1,x2,y2,x3,y3,col1,col2,col3,outline)
if argument9=true then pr_type=pr_linestrip else pr_type=pr_trianglelist;
draw_primitive_begin(pr_type);
draw_vertex_color(argument0,argument1,argument6);
draw_vertex_color(argument2,argument3,argument7);
draw_vertex_color(argument4,argument5,argument8);
if pr_type=pr_linestrip then draw_vertex(argument0,argument1);
draw_primitive_end();

74
General ENIGMA / collision_primitives
« on: May 26, 2008, 07:11:06 AM »
While ludamad is making the collisions, would it be possible to add in things like:
collision_primitive_begin()
collision_vertex()
collision_primitive_end()

75
Proposals / Separate Forums = Bad
« on: May 23, 2008, 01:02:58 PM »
Why are their three "Help" forums for ENIGMA?  I know the GMC does it, but this really can annoy some people and create arguments over "im not noob so y r i in teh noob forum!!!11!!1!"  Really, this will only create a status marking, which is bad.

Pages: « 1 2 3 4 5