まだ完成してませんが、PyGameで作ってみました。
Python
import pygame
from pygame.locals import *
import sys
class Player():
def __init__(self, x, y, image):
self.x = x
self.y = y
self.image = pygame.image.load(image)
self.anim = [[],[],[],[]]
self.anim[0].append(self.image)
self.muki = 0
self.ugoki = 0
def walk_animation_add(self, image_parts, muki):
image_parts_load = pygame.image.load(image_parts)
self.anim[muki].append(image_parts_load)
def main():
pygame.init()
pygame.display.set_mode((640, 480))
pygame.display.set_caption("オリジナルRPGゲーム")
screen = pygame.display.get_surface()
# 横が20で縦が15
map = [
[
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0],
],
[
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
],
]
stage = 0
stage_flag_0 = True
stage_flag_1 = False
player = Player(320, 224, "main_character_32x32_down.png")
player.walk_animation_add("main_character_32x32_down_left_parts.png", 0)
player.walk_animation_add("main_character_32x32_down_right_parts.png", 0)
player.walk_animation_add("main_character_32x32_up.png", 1)
player.walk_animation_add("main_character_32x32_up_left_parts.png", 1)
player.walk_animation_add("main_character_32x32_up_right_parts.png", 1)
player.walk_animation_add("main_character_32x32_left.png", 2)
player.walk_animation_add("main_character_32x32_left_left_parts.png", 2)
player.walk_animation_add("main_character_32x32_left_right_parts.png", 2)
player.walk_animation_add("main_character_32x32_right.png", 3)
player.walk_animation_add("main_character_32x32_right_left_parts.png", 3)
player.walk_animation_add("main_character_32x32_right_right_parts.png", 3)
grass_tile = pygame.image.load("grass_tile_32x32.png")
miti_tile = pygame.image.load("miti_tile_32x32.png")
while(True):
pygame.display.update()
screen.fill(( 0, 0, 0, 0))
for i in range(15):
for j in range(20):
if map[stage][i][j] == 0:
screen.blit(grass_tile, (32 * j, 32 * i))
elif map[stage][i][j] == 1:
screen.blit(miti_tile, (32 * j, 32 * i))
screen.blit(player.anim[player.muki][player.ugoki % 3], (player.x, player.y))
pressed_keys = pygame.key.get_pressed()
if pressed_keys[K_LEFT]:
player.x -= 1.0
player.muki = 2
player.ugoki += 1
elif pressed_keys[K_RIGHT]:
player.x += 1.0
player.muki = 3
player.ugoki += 1
elif pressed_keys[K_UP]:
player.y -= 1.0
player.muki = 1
player.ugoki += 1
elif pressed_keys[K_DOWN]:
player.y += 1.0
player.muki = 0
player.ugoki += 1
if player.y > 470:
player.y = 15
stage = 1
elif player.y < 10:
player.y = 465
stage = 0
if player.ugoki == 99:
player.ugoki = 0
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if __name__ == "__main__":
main()
歩くアニメーションも出来てるしマップの切り替えも出来たし完成像は大体想像できますね。手数は多いんですけど・・・w