- Joined
- Jun 16, 2015
- Messages
- 207
- Reaction score
- 117
- First Language
- English
- Primarily Uses
[SIZE=14.6666666666667px]Hi there,[/SIZE]
[SIZE=14.6666666666667px]I've been trying to create a script in where the game using the player's sprite index of 1 for running and 0 for walking. I am not using the dash? method.[/SIZE]
[SIZE=14.6666666666667px]What I'm not understanding, as you'll see below, is how $game_player works. After studying how rpg maker vx ace's classes are set up, I would assume that you have to change the following:[/SIZE]
Game_Player.character_index = 1[SIZE=14.6666666666667px]For running, as Player inherits it's properties from CharacterBase.[/SIZE]
[SIZE=14.6666666666667px]Now, I know you can't just put Game_Player.character_index = 1 inside of Scene_Map as it doesn't exist locally to that class...So I assumed you would have to use $game_player.character_index if that actually is possible...But that doesn't work at all.[/SIZE]
[SIZE=14.6666666666667px]The outline I've got for the code is simple. It's like:[/SIZE]
class Scene_Map alias ac_scene_map_update def updateac_scene_map_update#if (Input.pressed?
C)) #$game_player.running = true #$game_player.speed = 3 #Change graphic index to 1 here#else #$game_player.running = false #$game_player.speed = 2 #Change graphic index to 0 here#end endend[SIZE=14.6666666666667px]Though of course, this does not work. Another thing I'm understanding is that you could create a local instance of Game_Player like this inside of the scene:[/SIZE]
@game_player = Game_Player.new()[SIZE=14.6666666666667px]...but isn't an instance of the player created already? I assumed that's what $game_player was, and that you could manipulate the properties of the player object easily like $game_player.x = 5 or something...but that doesn't work either.[/SIZE]
[SIZE=14.6666666666667px]Any help would be greatly appreciated.[/SIZE]
[SIZE=14.6666666666667px]I've been trying to create a script in where the game using the player's sprite index of 1 for running and 0 for walking. I am not using the dash? method.[/SIZE]
[SIZE=14.6666666666667px]What I'm not understanding, as you'll see below, is how $game_player works. After studying how rpg maker vx ace's classes are set up, I would assume that you have to change the following:[/SIZE]
Game_Player.character_index = 1[SIZE=14.6666666666667px]For running, as Player inherits it's properties from CharacterBase.[/SIZE]
[SIZE=14.6666666666667px]Now, I know you can't just put Game_Player.character_index = 1 inside of Scene_Map as it doesn't exist locally to that class...So I assumed you would have to use $game_player.character_index if that actually is possible...But that doesn't work at all.[/SIZE]
[SIZE=14.6666666666667px]The outline I've got for the code is simple. It's like:[/SIZE]
class Scene_Map alias ac_scene_map_update def updateac_scene_map_update#if (Input.pressed?
@game_player = Game_Player.new()[SIZE=14.6666666666667px]...but isn't an instance of the player created already? I assumed that's what $game_player was, and that you could manipulate the properties of the player object easily like $game_player.x = 5 or something...but that doesn't work either.[/SIZE]
[SIZE=14.6666666666667px]Any help would be greatly appreciated.[/SIZE]
Last edited by a moderator:
