Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> LoG Movement Help (SOLVED), Legacy of Goku Movement Help. (SOLVED)
Zinx10
post Nov 7 2012, 04:16 AM
Post #1


Master of Darkness
Group Icon

Group: Revolutionary
Posts: 1,194
Type: Developer
RM Skill: Advanced
Rev Points: 5




So, I am making a script similar to Legacy of Goku's movement system. I just have one problem: I always face down when I do not press a key. I think it may have to do with the if-branches, but I do not know why. Here is the script:
CODE
/*
-Legacy of Goku-
-Walk System-

HOW TO USE:
            log_walk(character name, character walk speed, stand_down, stand_up, stand_left, stand_right);
            
WHAT EACH ONE MEANS:
            Character Name = Put the character name following your naming system (within a string and don't add 'spr_').
            Character Walk Speed = How many pixels your character moves per step.
            Stand_Down (Temporary Possibly) = Character standing still (down).
            Stand_Up (Temporary Possibly) = Character standing still (up).
            Stand_Left (Temporary Possibly) = Character standing still (left).
            Stand_Right (Temporary Possibly) = Character standing still (right).
*/

direction_choice = 1;
          
//Put a keyboard check
if keyboard_check(vk_left) && !keyboard_check(vk_right){
    if !(keyboard_check(vk_down) && keyboard_check(vk_up)){
    //if image_speed = .06666666667{
        if xprevious = x && yprevious = y{
            execute_string('sprite_index = ' + 'spr_' + argument0 + '_walk' + '_l');
        }
    //}
        direction_choice = 3;
        image_speed = .2;
        x -= argument1;
    }
}
if keyboard_check(vk_right) && !keyboard_check(vk_left){
    if !(keyboard_check(vk_down) && keyboard_check(vk_up)){
    //if image_speed = .06666666667{
        if xprevious = x && yprevious = y{
            execute_string('sprite_index = ' + 'spr_' + argument0 + '_walk' + '_r');
        }
    //}
        direction_choice = 4;
        image_speed = .2;
        x += argument1;
    }
}
if keyboard_check(vk_down) && !keyboard_check(vk_up){
    if !(keyboard_check(vk_left) && keyboard_check(vk_right)){
    //if image_speed = .06666666667{
        if xprevious = x && yprevious = y{
            execute_string('sprite_index = ' + 'spr_' + argument0 + '_walk' + '_d');
        }
    //}
        direction_choice = 1;
        image_speed = .2;
        y += argument1;
    }
}
if keyboard_check(vk_up) && !keyboard_check(vk_down){
    if !(keyboard_check(vk_left) && keyboard_check(vk_right)){
    //if image_speed = .06666666667{
        if xprevious = x && yprevious = y{
            execute_string('sprite_index = ' + 'spr_' + argument0 + '_walk' + '_u');
        }
    //}
        direction_choice = 2;
        image_speed = .2;
        y -= argument1;
    }
}
//Check to see if no key is pressed.
if xprevious = x && yprevious = y{
    image_speed = .06666666667;
    if direction_choice = 2{
        //execute_string('sprite_index = ' + 'spr_' + argument0 + '_stand' + '_u');
        sprite_index = argument3;
    }
    if direction_choice = 3{
        //execute_string('sprite_index =' + 'spr_' + argument0 + '_stand' + '_l');
        sprite_index = argument4;
    }
    if direction_choice = 4{
        //execute_string('sprite_index = ' + 'spr_' + argument0 + '_stand' + '_r');
        sprite_index = argument5;
    }
    if direction_choice = 1{
        //execute_string('sprite_index = ' + 'spr_' + argument0 + '_stand' + '_d');
        sprite_index = argument2;
    }
}


Here is the player's create event:
CODE
//sound_loop(bgm_westcity);
walk_speed = 4;
image_speed = .06666666667;


Here is the player's step event:
CODE
log_walk('gohan',walk_speed,spr_gohan_stand_d,spr_gohan_stand_u,spr_gohan_stand_l,spr_gohan_
stand_r);


Here is an image of the player (Gohan) walking:


Please help. ;-;

This post has been edited by Zinx_therpgmaker: Nov 7 2012, 12:25 PM


__________________________
My Games
Phelxyre: Time Unbound (Current Project)
Game Thread
A game where you start in the future, but you go to the past, to make things right, hopefully.

The Hidden World
Game Thread
An Arcade-style game where you must go through various puzzles to see if you go home.

Here are all the things I Support (They Include Links!)




Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
markchapman10
post Nov 7 2012, 05:21 AM
Post #2


Visit the Map Shop for all your mapping needs!
Group Icon

Group: Staff
Posts: 245
Type: Mapper
RM Skill: Skilled




if you think its your if statements maybe you could use the Drag and Drop rather then coding the keyboard buttons It would be a little more organized and you may find your problem. Thats what I do when I cant get something.
Go to the top of the page
 
+Quote Post
   



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 08:33 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker