-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9abec75
Showing
881 changed files
with
40,592 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"program": "${file}" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
// Path to the Love2D executable file | ||
"pixelbyte.love2d.path": "D:\\Program Files\\Love\\love.exe", | ||
|
||
// Runs Love2D with a console window for debugging. (Windows Only) | ||
"pixelbyte.love2d.debug": false, | ||
|
||
// Whenever a file is saved, Love2D is executed on the workspace folder | ||
"pixelbyte.love2d.runOnSave": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "1.0.0", | ||
"command": "love", | ||
"isShellCommand": true, | ||
"args": [ | ||
"." | ||
], | ||
"tasks": [ | ||
{ | ||
"taskName": "build", | ||
"args": [ | ||
"." | ||
], | ||
"problemMatcher": [ | ||
"$node-sass" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "lib/middleclass" | ||
require "lib/anim8" | ||
|
||
Actor=calss("actor") | ||
Actor.property={} | ||
function Actor:init(actorData) | ||
for k, v in pairs(actorData) do | ||
Actor.property.k=v | ||
end | ||
end | ||
|
||
function Actor:move(x,y) | ||
Actor.property.x = x | ||
Actor.property.y = y | ||
end | ||
|
||
function Actor:draw() | ||
local imagePath = "" .. Actor.property["行走图"] | ||
local image = love.graphics.newImage() | ||
love.graphics.draw() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
date = {year=0,month=0,week=0,day=0,hour=0,minute=0,second=0,turn=0} | ||
animals = {"鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"} | ||
weeks = {"上旬","中旬","下旬"} | ||
days = {"月曜日","火曜日","水曜日","木曜日","金曜日","土曜日","日曜日"} | ||
hours = {"子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"} | ||
months = {"正","二","三","四","五","六","七","八","九","十","冬","腊"} | ||
numbers = {"〇","一","二","三","四","五","六","七","八","九"} | ||
season = {"春","夏","秋","冬"} | ||
weather = { "晴","多云","阴","阵雨","雷阵雨","雷阵雨伴有冰雹", | ||
"雨夹雪","小雨","中雨","大雨","暴雨","大暴雨","特大暴雨", | ||
"阵雪","小雪","中雪","大雪","暴雪","雾","冻雨","沙尘暴", | ||
"小到中雨","中到大雨","大到暴雨","暴雨到大暴雨", | ||
"大暴雨到特大暴雨","小到中雪","中到大雪","大到暴雪", | ||
"浮尘","扬沙","沙尘暴","强沙尘暴","特强沙尘暴轻雾", | ||
"浓雾强浓雾","轻微霾","轻度霾","中度霾","重度霾","特强霾","霰","飑线"} | ||
|
||
font = love.graphics.newFont("assets/font/simsun.ttf", 18) | ||
love.graphics.setFont(font) | ||
|
||
function date:update(dt) | ||
-- 1年 = 12 月 * 3 旬 * 7 天 * 12 时辰 * 120 分 * 60 秒 * 60 帧 = 15552000 | ||
-- 计算年月日 | ||
date.second = date.second + 100 | ||
date.new(date.second) | ||
end | ||
|
||
function date:draw() | ||
-- colorText(colorstr) | ||
local d = date | ||
local yearStr = hours[d.year]..animals[d.year] | ||
local monthStr = months[d.month] | ||
local weekStr = weeks[d.week] | ||
local dayStr = days[d.day] | ||
local hourStr = hours[d.hour] | ||
dateStr = string.format("%s年%s月%s%s%s时",yearStr,monthStr,weekStr,dayStr,hourStr) | ||
love.graphics.print(dateStr,560,0) | ||
end | ||
|
||
--- 将数字转为文字 | ||
function replaseNumber(number) | ||
-- local numbers = number .."" | ||
numbers = string.gsub(number,"1", "一") | ||
numbers = string.gsub(numbers,"2", "二") | ||
numbers = string.gsub(numbers,"3", "三") | ||
numbers = string.gsub(numbers,"4", "四") | ||
numbers = string.gsub(numbers,"5", "五") | ||
numbers = string.gsub(numbers,"6", "六") | ||
numbers = string.gsub(numbers,"7", "七") | ||
numbers = string.gsub(numbers,"8", "八") | ||
numbers = string.gsub(numbers,"9", "九") | ||
numbers = string.gsub(numbers,"0", "〇") | ||
return numbers | ||
end | ||
|
||
function date.new(second) | ||
date.second = second | ||
date.minute = math.modf(date.second/60) | ||
date.hour = math.modf(date.minute/60) | ||
date.day = math.modf(date.hour/12) | ||
date.week = math.modf(date.day/7) | ||
date.month = math.modf(date.week/3) | ||
date.year = math.modf(date.month/12) | ||
-- | ||
date.minute = math.modf(date.minute%60)+1 | ||
date.hour = math.modf(date.hour%12)+1 | ||
date.day = math.modf(date.day%7)+1 | ||
date.week = math.modf(date.week%3)+1 | ||
date.month = math.modf(date.month%12)+1 | ||
date.year = math.modf(date.year%12)+1 | ||
return date | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
local Screen = require( "lib/Screen" ) | ||
local sti = require "sti" | ||
local actorsdata=require "assets/data/actors" | ||
local anim8 = require 'lib/anim8' | ||
-- local Class = require "lib/middleclass" | ||
require "Date" | ||
-- 主要对象类,角色类,房间类,区域类 | ||
require "Actor" | ||
require "Npc" | ||
require "assets/data/actors" | ||
require "assets/data/rooms" | ||
require "lib/guiDraw" | ||
require "lib/colorT" | ||
require "lib/drawTool" | ||
local GameScreen = {} | ||
local map | ||
local world | ||
local tx, ty | ||
local font | ||
local canvas = love.graphics.newCanvas() | ||
local canvasGUI = love.graphics.newCanvas() | ||
local tx | ||
local ty | ||
-- shader | ||
local code =[[ | ||
vec4 effect(vec4 color,Image texture,vec2 tc,vec2 sc){ | ||
return Texel(texture,vec2((tc.x-0.5)/(tc.y+1)+0.5,tc.y)); | ||
} | ||
]] | ||
shader = love.graphics.newShader(code) | ||
|
||
-- npc table | ||
function canvasLoad() | ||
love.graphics.setCanvas(canvas) | ||
love.graphics.clear() | ||
map:draw(-tx,-ty) | ||
map:box2d_draw(-tx,-ty) | ||
love.graphics.setCanvas() | ||
end | ||
|
||
function canvasGUIload() | ||
love.graphics.setCanvas(canvas) | ||
love.graphics.clear() | ||
guiDraw() | ||
love.graphics.print("FPS:" .. love.timer.getFPS(),1220,0) | ||
drawTile(actorImgs[1],0,0,32,48,640,400) | ||
-- 绘制时间 | ||
-- date.draw() | ||
love.graphics.setCanvas() | ||
end | ||
|
||
function loadData( ) | ||
-- actor class | ||
actor=Actor:new(actors["段誉"]) | ||
-- actor:readData(actors["段誉"]) | ||
-- npc1 = Actor:new(actors["言达平"]) | ||
-- npc2 = Actor:new(actors["鲁坤"]) | ||
npcs:add(actors,5) | ||
-- npc1.x = 500 | ||
-- npc1.y = 600 | ||
-- npc2.x = 800 | ||
-- npc2.y = 1000 | ||
-- npc1:readData(actors["言达平"]) | ||
-- actor.misc = {} | ||
-- | ||
font = love.graphics.newFont("assets/font/msyh.ttf", 18) | ||
love.graphics.setFont(font) | ||
map = sti("assets/tileMaps/wuguan.lua",{"box2d"}) | ||
-- Prepare translations | ||
tx, ty = 0, 0 | ||
-- Prepare physics world | ||
love.physics.setMeter(32) | ||
world = love.physics.newWorld(0, 0) | ||
map:box2d_init(world) | ||
-- Create a Custom Layer | ||
map:addCustomLayer("Sprite Layer", 5) | ||
-- Add data to Custom Layer | ||
local spriteLayer = map.layers["Sprite Layer"] | ||
|
||
spriteLayer.sprites = { | ||
player = {} | ||
} | ||
-- Update callback for Custom Layer | ||
function spriteLayer:update(dt) | ||
local objs = map.layers[7].objects | ||
for i=1,#objs,1 do | ||
local objName = objs[i].name | ||
local bx,by = objs[i].x,objs[i].y | ||
local ax,ay = actor.x/2,actor.y/2 | ||
local distance=math.abs(bx-ax) + math.abs(by-ay) | ||
-- print(distance) | ||
-- print( distance ) | ||
if (distance<100) then | ||
actor.target = objName .. ":"..bx .. ":".. by | ||
break | ||
else | ||
actor.target = "" | ||
end | ||
end | ||
end | ||
-- | ||
function spriteLayer:draw() | ||
for _, sprite in pairs(self.sprites) do | ||
local x = math.floor(actor.x/2) | ||
local y = math.floor(actor.y/2) | ||
actor:drawAnim() | ||
npcs:drawAnim() | ||
-- npc1:drawAnim() | ||
-- npc2:drawAnim() | ||
-- actor:drawFly() | ||
end | ||
end | ||
|
||
|
||
canvasLoad() | ||
end | ||
|
||
|
||
function GameScreen.new( ) | ||
local self=Screen.new() | ||
loadData() | ||
function self:draw() | ||
love.graphics.setShader(shader) | ||
love.graphics.draw(canvas) | ||
love.graphics.setShader() | ||
-- GUI | ||
guiDraw() | ||
-- actor:draw() | ||
-- actor:drawBag() | ||
love.graphics.print("FPS:" .. love.timer.getFPS(),1220,0) | ||
date.draw() | ||
end | ||
|
||
function self:update( dt ) | ||
world:update(dt) | ||
map:update(dt) | ||
actor:key(dt) | ||
actor:update(dt) | ||
-- npc1:update(dt) | ||
npcs:update(dt) | ||
-- 地图的位移 | ||
tx = math.floor((actor.x - 1280)/ 2) | ||
ty = math.floor((actor.y - 800)/ 2) | ||
-- 画布 | ||
canvasLoad() | ||
guiUpdata(actor,dt) | ||
date.update() | ||
end | ||
return self | ||
end | ||
|
||
|
||
return GameScreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
local Screen = require( "lib/Screen" ) | ||
local HelpScreen = {} | ||
local bg = love.graphics.newImage("bg.jpeg") | ||
local font = love.graphics.newFont("assets/font/msyh.ttf", 24) | ||
local titlefont = love.graphics.newFont("assets/font/msyh.ttf", 48) | ||
local menu ={} | ||
local index = 1 | ||
function HelpScreen.new( ) | ||
love.graphics.setFont(font) | ||
local self=Screen.new() | ||
-- local x,y,w,h = 20,20,40,20 | ||
title = love.graphics.newText(titlefont,"侠客宝典") | ||
|
||
|
||
function self:draw( ) | ||
love.graphics.draw(bg, 0, 0, 0) | ||
love.graphics.setColor(0, 0, 0, 255) | ||
love.graphics.draw(title, 300, 40) | ||
love.graphics.setColor(255,255,255, 255) | ||
|
||
end | ||
|
||
function self:update( dt ) | ||
|
||
end | ||
|
||
function self:keypressed(key) | ||
if key=="e" and index>1 then | ||
index = index -1 | ||
elseif key=="d" and index<4 then | ||
index = index + 1 | ||
elseif key=="j" or "k" then | ||
print(key) | ||
end | ||
end | ||
return self | ||
end | ||
|
||
|
||
return HelpScreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Simple Tiled Implementation | ||
|
||
This code is licensed under the [**MIT/X11 Open Source License**][MIT]. | ||
|
||
Copyright (c) 2014 Landon Manning - [email protected] - [LandonManning.com][LM] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
[MIT]: http://www.opensource.org/licenses/mit-license.html | ||
[LM]: http://LandonManning.com |
Oops, something went wrong.