Jump to content


darkkyoun

Member Since 04 May 2012
Offline Last Active Aug 26 2012 01:00 AM

Topics I've Started

smooth angle turning

18 August 2012 - 11:27 AM

Hi ,

As the topic suggest, I am trying to make my object have a smooth angle turning.

Posted Image

With the object image_angle change accordingly from x1 to x2.


My current code:

    if going_left=3  // when in this state
        if x <=375
        {
            speed=0;
            vspeed=2;
            image_angle = point_direction(sticky_obj.x,sticky_obj.y,x,y-10);  // this is the one that is helping my object image angle turn but it is not smooth.
            going_left=4;
        }



So my question is , is there a better way to code it?

star system

27 July 2012 - 01:37 AM

Hi,

I am trying to draw the display the number of stars according to the time left. However it always only draw 1 star only. where did I do wrong ??

this is my code under obj_time_control
// create event 
star =0;

// step event
if time4 <= 40
{
    star = 3;
}
else if time4 <= 39 and time4 >= 20
{
    star = 2;
}
else if time4 >= 19
{
    star = 1
}
// break 
if time5 <= 40
{
    star = 3;
}
else if time5 <= 39 and time5 >= 20
{
    star = 2;
}
else if time5 >= 19
{
    star = 1
}


// draw event 
if room = level1_score or room = level2_score or room = level3_score or room= sticky_score
{
for (i = 0; i < star; i += 1){draw_sprite(star_spr,-1,500+(i*16),100)
}
}

Collision problem

15 July 2012 - 01:34 PM

Hi,

I am trying to make a simulation game, where obj_passenger have to wait at an area before boarding. However  there is a challenge to it, that area can only hold up to maximum 20  passenger.


This is how I code it:

under obj_controller, alarm event:

{
alarm[0]=120;
instance_create(obj_indication.x,obj_indication.y,obj_passenger);
}

under obj_passenger, create event
{
motion_set(90,3);
alarm[0]=50;  // set timer
}

under alarm event:
{
alarm[0]=50; // when timer is up*//
motion_set(choose(0,90,180,270),3); // obj_passenger will roam ard the area
}


under step event:
{
if distance_to_object(obj_chair)<=20
    {
        test=instance_nearest(x,y,obj_chair);
        move_towards_point(test.x,test.y,3);
    }
else
    {
        exit;
    }
}

and
{
if distance_to_object(obj_passenger) < 10
{
with(self)move_towards_point(obj_passenger.x, obj_passenger.y, -3) 
}

else
    {
        exit;
    }
}


that's where the problem is , they (referring to obj_passenger)  just keep overlapping each other despite the fact that I have code them to move away from each other if there are too near. where did I do wrong??

Basic Movement.

05 July 2012 - 03:06 AM

HI,

I am currently trying to iron out a problem in my RPG game.


My current movement are x +=4;  //movement for right , x -=4; //movement for left
                                   y +=4; //movement for down , y -=4; //movement for up


when place_meeting(x,y,wall_corner)
{
motion_set(0,0);
}

This code does not work, where did I do wrong?

Smooth Movement

01 July 2012 - 08:56 AM

Hi,
I am currently trying to make my object move from x1 to x2 smoothly. However my current code does not allow me so
The current code I am using to change the object direction are :

if going_left=3  // when in this state
        if (place_meeting(x,y,sticky_obj)) = false // check if we run out of sticky_obj
        {
            hspeed=0;
            gravity=0;
            vspeed=2;
            image_angle = 90;
        }


which lead to the scene below
Posted Image



So my question is, how to make it move smoothly  [See Picture below]
Posted Image