Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> 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
   
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
   
Zinx10
post Nov 7 2012, 12:22 PM
Post #3


Master of Darkness
Group Icon

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




QUOTE (markchapman10 @ Nov 7 2012, 06:21 AM) *
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.

That is what I said. I will try the drag-and-drop.

EDIT:
Nevermind, I solved it. ^^'
It was this little code at the top of the script:
CODE
direction_choice = 1;

That means I will always face down.

This post has been edited by Zinx_therpgmaker: Nov 7 2012, 12:24 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
   
Rukiri
post Nov 7 2012, 03:10 PM
Post #4


emerge -avt awesome! Wait... it brings me.... HERE?!
Group Icon

Group: Revolutionary
Posts: 1,717
Type: Scripter
RM Skill: Advanced




Here I'll help you out a bit, 8-way movement is easy you still use 4 directions but this will simplify your keyboard input code.

CODE
if (keyboard_check(vk_up) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "u"; }
� else if (keyboard_check(vk_right) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "r"; }
� else if (keyboard_check(vk_down) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "d"; }
� else if (keyboard_check(vk_left) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "l"; }
� if (keyboard_check(vk_up) && keyboard_check(vk_left) && dir!="u" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_up) && keyboard_check(vk_right) && dir!="u" && dir!="r") { dir = "r"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_left) && dir!="d" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_right) && dir!="d" && dir!="r") { dir = "r"; }


__________________________
Xeilsoft
- Follow your dreams to the very end..

Kits that I'm working on.
[Unity3D 4.0] LTTP/Minish Cap - I don't have time for custom gfx like what the pze folks are doing but I will try and work on some enhanced LTTP graphics.

Main PC
Core i7 3820 overclocked @ 4.8GHZ
Galaxy: Nvidia Geforce GTX 680 GDDR5 2GB
Asrock X79 Extreme9 w' creative sound
64GB corsair platinum @ 1600MHZ
Muchkin 128GB SSD(boot), OZKIN 2TB SSD, Western Digital GREEN 1TB HDD.
Rosewill Lightning 1000W PSU
OS: Funtoo Linux, Windows 8 (Virtual Machine)

iMac (March 2013)
3.4GHz Quad-core Intel Core i7, Turbo Boost up to 3.9GHz
16GB 1600MHz DDR3 SDRAM - 2X8GB
1TB Serial ATA Drive @ 7200 rpm
NVIDIA GeForce GTX 680MX 2GB GDDR5
Go to the top of the page
 
+Quote Post
   
Zinx10
post Nov 7 2012, 06:49 PM
Post #5


Master of Darkness
Group Icon

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




QUOTE (Rukiri @ Nov 7 2012, 03:10 PM) *
Here I'll help you out a bit, 8-way movement is easy you still use 4 directions but this will simplify your keyboard input code.

CODE
if (keyboard_check(vk_up) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "u"; }
� else if (keyboard_check(vk_right) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "r"; }
� else if (keyboard_check(vk_down) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "d"; }
� else if (keyboard_check(vk_left) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "l"; }
� if (keyboard_check(vk_up) && keyboard_check(vk_left) && dir!="u" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_up) && keyboard_check(vk_right) && dir!="u" && dir!="r") { dir = "r"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_left) && dir!="d" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_right) && dir!="d" && dir!="r") { dir = "r"; }

dir u and dir I? Never heard of those. What do they do?


__________________________
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
   
markchapman10
post Nov 7 2012, 07:03 PM
Post #6


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

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




QUOTE (Zinx_therpgmaker @ Nov 7 2012, 06:49 PM) *
QUOTE (Rukiri @ Nov 7 2012, 03:10 PM) *
Here I'll help you out a bit, 8-way movement is easy you still use 4 directions but this will simplify your keyboard input code.

CODE
if (keyboard_check(vk_up) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "u"; }
� else if (keyboard_check(vk_right) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "r"; }
� else if (keyboard_check(vk_down) && !keyboard_check(vk_left) && !keyboard_check(vk_right)) { dir = "d"; }
� else if (keyboard_check(vk_left) && !keyboard_check(vk_down) && !keyboard_check(vk_up)) { dir = "l"; }
� if (keyboard_check(vk_up) && keyboard_check(vk_left) && dir!="u" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_up) && keyboard_check(vk_right) && dir!="u" && dir!="r") { dir = "r"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_left) && dir!="d" && dir!="l") { dir = "l"; }
� else if (keyboard_check(vk_down) && keyboard_check(vk_right) && dir!="d" && dir!="r") { dir = "r"; }

dir u and dir I? Never heard of those. What do they do?

Its probably the variable he used for the characters direction.
Go to the top of the page
 
+Quote Post
   
X-M-O
post Nov 8 2012, 01:30 AM
Post #7


Level 82
Group Icon

Group: Director
Posts: 6,347
Type: None
RM Skill: Undisclosed




Yeah, it's not an "i", it's an "L". U = Up, D = Down, L = Left, and R = Right. =]


__________________________
Go to the top of the page
 
+Quote Post
   
Zinx10
post Nov 8 2012, 06:58 AM
Post #8


Master of Darkness
Group Icon

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




QUOTE (X-M-O @ Nov 8 2012, 02:30 AM) *
Yeah, it's not an "i", it's an "L". U = Up, D = Down, L = Left, and R = Right. =]

Oh, thank you! Thank you too, Mark.


__________________________
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
   

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: 19th May 2013 - 12:14 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker