GMS 2 Few issue. I record video on youtube :-)

S

SuG4Ru

Guest
Ok here is a video and please dont punish me for accent and all aboat my english i know its terrible.
Here is first code for sticking object :

Code:
//Variables

image_angle           = obj_player_player1.image_angle  ;  // Copying image_angle of another object in this case image angle of object1 is apply to image_angle object2
object_to_stick       = obj_player_player1              ;  // Here add object you want to stick object1 stick to object2 [object 2 is where this code add]
angle_of_object_use   = obj_player_player1              ;  // If you want copy direction of some object and apply to this object
direction_of_object   = 315                             ;  // degreases in which way from object 1 want to show
distance_of_object_x  = 100                             ;  // distance from object
distance_of_object_y  = 100                             ;  // distance from object
angle_object          = 0                               ;  // If you want rotate object2
initial_angle         = -80                                ;  // I think its same like angle_object

// Piece of the code

x = object_to_stick.x + lengthdir_x(distance_of_object_x, direction_of_object + object_to_stick.image_angle);
y = object_to_stick.y + lengthdir_y(distance_of_object_y, direction_of_object + object_to_stick.image_angle);
image_angle = angle_object + angle_of_object_use.image_angle + initial_angle;

Here is code from weapon:

Code:
//variables

kspace   = keyboard_check ( vk_space )  ;
global.attackspeed = 4                  ;
global.diremp      = 1                  ;
global.diremm      = 0                  ;
global.dire        = direction          ;
attackspeed        = global.attackspeed ;
diremp             = global.diremp      ;
diremm             = global.diremm      ;
dire               = global.dire        ;
//code for attack move


// slashing


if !kspace
    {
    image_angle = -50 + obj_player_player1.image_angle + 0;
    direction = 0 ;
    }

if kspace & diremp = 1
    {
    image_angle = direction - 50 + obj_player_player1.image_angle + 0 ; 
    direction += attackspeed ;
    if direction >= 50
        {
        diremp = 0 ;
        diremm = 1 ;
        }
    }

if kspace & diremm = 1
    {
    image_angle = direction -50 + obj_player_player1.image_angle + 0 ; 
    direction -= attackspeed ;
  
    if direction <= 0
        {
        diremm = 0 ;
        diremp = 1 ;
        }
    }

//Size

image_xscale = 0.4 ;
image_yscale = 0.4 ;

//code for position and direction

x=obj_player_hand.x ;
y=obj_player_hand.y ;

Here is code for moving and shifting:

Code:
//____________________________________________________________________________________________
//-------------------------------
//-----------Variables-----------
//-------------------------------


//-------------Keys--------------



kup            = keyboard_check ( ord ( "W" )  )  ; //  Up        = W Key
kdown           = keyboard_check ( ord ( "S" )  )  ; //  Down      = S Key
kleft          = keyboard_check ( ord ( "A" )  )  ; //  Left      = A Key
kright         = keyboard_check ( ord ( "D" )  )  ; //  Right     = D Key
kshift         = keyboard_check ( vk_shift )      ; //  Shifting  = Shift Key

//-----------Shortcuts-----------

timecs         = delta_time / 10000 / room_speed ; // 0,01 second
//(room_speed / room_speed) /100  ;//  (60 / 60) = 1 / 100 = 0,01 * 1 = 0,01 seconds  -- 500 = 5 seconds

//------------True-False---------

shifting       = 0;

//----------Stats Numbers--------

normalspeed    = 10  ;  // global.normalspeed
movespeed      = normalspeed  ;
shiftspeed     = 4   ;  // global.shiftspeed
shiftcooldown  = 3 * room_speed ; // global.shiftingcooldown
global.movespeed     = movespeed ;
global.shiftcooldown = shiftcooldown;
global.shifting      = shifting ;

//____________________________________________________________________________________________



//Shifting - distance





// Shifting - duration
  
if kshift   
    {
    if shifting <= 0
        {
        movespeed = normalspeed * shiftspeed ;
        shifting += 1;
        }
    else if shifting >=  0
        {
        movespeed = normalspeed ;
        }
    }

if shifting >= shiftcooldown
    {
    shifting = 0 ;
    }


//Up             = North
speed = 0 ;

if kup
    {
    direction    = image_angle + 0      ;
    speed        = movespeed            ;
    }

//Down           = South

if kdown
    {
    direction    = image_angle + 180   ;
    speed        = movespeed           ;
    }

//Left           = West

if kleft
    {
    direction    = image_angle + 90     ;
    speed        = movespeed            ;
    }

//Right          = East

if kright
    {
    direction    = image_angle + 270    ;
    speed        = movespeed            ;
    }

// Up   + Left   = North + West

if kup & kleft
    {
    direction    = image_angle + 45     ;
    speed        = movespeed            ;
    }

// Up   + Right  = North + East

if kup & kright
    {
    direction    = image_angle + 315    ;
    speed        = movespeed            ;
    }

// Down + Left   = South + West

if kdown & kleft
    {
    direction    = image_angle + 135    ;
    speed        = movespeed            ;
    }

// Down + Right  = South + East

if kdown & kleft
    {
    direction    = image_angle + 225    ;
    speed        = movespeed            ;
    }

//____________________________________________________________________________________________

Thank you for reading and answers.
 
Top