Jump to content


spoloon

Member Since 27 Dec 2010
Offline Last Active Mar 23 2012 11:10 PM

Posts I've Made

In Topic: how do i use lengthdir_x and lengthdir_y ?

18 August 2011 - 05:36 PM

let's say you want to move 4 pixels in an angel of 30.
what you do is this:

x+=lengthdir_x(4,30); //arg0 - length: 4,   arg1 - direction: 30
y+=lengthdir_y(4,30);
basically, lengthdir_x returns how much you need to add to the X value in order to move arg0 pixels in the direction specified in arg1.
lengthdir_y does that with the Y.
hope this helps.


awsome thanx for the help. but i figured out a little diffrently
i used
DX=32
DY=0

Len = point_distance(0, 0, DX, DY);
Angle = point_direction(0, 0, DX, DY);


bullet_id = instance_create(x + lengthdir_x(Len, Angle + image_angle), y + lengthdir_y(Len, Angle + image_angle), obj_bullet);
bullet_id.direction = image_angle;
bullet_id.speed = 10;

In Topic: options box ?

12 April 2011 - 07:25 PM

DRAW EVENT

draw_text(x,y,"Button1")//The text for button one
draw_text(x,y+32,"Button2")//The text for button two


if mouse_x>x and mouse_x<x+124
{
    if mouse_y>y and mouse_y<y+32//BUTTON 1
    {
    draw_sprite(spr_button_highlight,0,x,y)
        if mouse_check_button_pressed(mb_left) {"execute your code here"}
    }
    
    else if mouse_y>y+32 and mouse_y<y+64//BUTTON 2
    {
    draw_sprite(spr_button_highlight,0,x,y+32)
        if mouse_check_button_pressed(mb_left) {"execute your code here"}
    }
    
}

There is my code for doing making buttons with one object, this is working down the list by 124x32(my example is 124x15)

heres my example of what i made it for
Posted Image

from what i understood... this is exactly what your looking for, you should be able to figure out its format and can just editing it however you need.

HOPE THIS HELPS


this is exactly what i am talking about thanx.

In Topic: Distribute following objects for other objects?

09 January 2011 - 01:21 AM

//in obj_ship's create

has_turret = 0

//in the turrets create
giveup = 0
with (obj_ship)
{
if other.giveup = 0
{
if has_turret = 0
{
other.target = id
has_turret = 1
other.giveup = 1
}
}
}

// turret's step
x = target.x
y = target.y

it said this when i tried
ERROR in
action number 1
of Create Event
for object turrets:

Error in code at line 2:
   if other.giveup = 0
            ^
at position 11: Unknown variable giveup
action number 1
of  Step Event
for object turrets:

Error in code at line 1:
   x = target.x
      ^
at position 5: Unknown variable target

In Topic: Path sprite changes

08 January 2011 - 03:22 AM

try
image_angle=direction

in the step event

In Topic: Need gun sprites

08 January 2011 - 12:22 AM


How about this ?