![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Lua
文章平均质量分 62
eddygong
这个作者很懒,什么都没留下…
展开
-
画移动球体
移动球体,包括下落加速度设定和移动设定,有碰撞效果function love.load()love.physics.setMeter(64) --the height of a meter our worlds will be 64pxworld = love.physics.newWorld(0, 9.81*64, true) --create a world for原创 2012-12-25 09:37:16 · 621 阅读 · 0 评论 -
平滑移动,可修改移动速度
function love.load() player = { grid_x = 256, grid_y = 256, act_x = 200, act_y = 200,speed = 8 }endfunction love.update(dt) --player.act_y =原创 2012-12-20 18:22:49 · 1005 阅读 · 0 评论 -
love2d 学习 - 代码3
function love.load()--define picturestile={}for i=1,4 dotile[i]= love.graphics.newImage("/res/l"..i..".png")endimgbomn = love.graphics.newImage("/res/Lei.png")imgjew = love.graph原创 2012-12-20 15:44:33 · 828 阅读 · 0 评论 -
固定大小方块的移动
function love.load()player={x=math.random(0,256),y=math.random(0,256)}endfunction love.draw()love.graphics.rectangle("fill",player.x,player.y,32,32)endfunction love.keypressed(原创 2012-12-20 18:16:46 · 667 阅读 · 0 评论 -
Love2D学习 - 代码2
function love.load()map_width = 60map_height = 40map={}--initialize the tablefor i = 1,map_width domap[i] = {}for j = 1,map_height domap[i][j] = math.random(0,3)endend原创 2012-12-20 15:01:33 · 1416 阅读 · 0 评论 -
Love2D学习1
--[[love.graphics.print("hello world",400,300)love.graphics.print("hello",400,300)love.graphics.setBackgroundColor(255,255,255)love.graphics.setColor(0,0,0,255)pacwidth = math.pi / 6 -- si原创 2012-12-19 18:16:24 · 3014 阅读 · 0 评论 -
paris和iparis的区别
标准库提供了集中迭代器,包括迭代文件每行的(io.lines),迭代table元素的(pairs),迭代数组元素的(ipairs),迭代字符串中单词的 (string.gmatch)等等。LUA手册中对与pairs,ipairs解释如下:ipairs (t)Returns three values: an iterator function, the table t, and 0,转载 2012-12-18 14:08:17 · 2173 阅读 · 0 评论 -
Lua学习笔记
前言 偶最近在学习Lua, 所以写出心得和大家共享, 争取一天写一篇, 嘿嘿. 才开始学所以内容很浅, 希望大家包涵. Lua是一种完全免费的脚本语言, 可以和C/C++语言紧密结合, 它的官方网站在http://www.lua.org. 在网站上可以下载到lua的源码, 没有可 执行版本, 不过不用担心, 因为lua源码可以在任何一种C/C++的编译器上编译转载 2012-12-18 13:58:37 · 618 阅读 · 0 评论 -
碰撞事件对应捕捉与处理实例
function love.load()--create a new worldworld = love.physics.newWorld(0,200,true)--These callback function names can be almost any you want:world:setCallbacks(beginContact,endContact,preSolve,原创 2012-12-26 14:02:38 · 726 阅读 · 0 评论 -
键盘事件捕获
function love.load()text = ""drawCircle = falsedownFont = falsex = 400y = 200--world = love.physics.newWorld(0,200,true)endfunction love.update(dt)if原创 2012-12-26 16:34:50 · 802 阅读 · 1 评论 -
继续
创建背景框和可移动方块function love.load() player = { grid_x = 256, grid_y = 256, act_x = 200, act_y = 200,speed = 16 }map = {{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1原创 2012-12-21 15:30:23 · 638 阅读 · 1 评论