aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/game/main.lua28
-rw-r--r--bin/game/particle.pngbin0 -> 1821 bytes
-rw-r--r--bin/jin.exebin540672 -> 554496 bytes
3 files changed, 26 insertions, 2 deletions
diff --git a/bin/game/main.lua b/bin/game/main.lua
index 8ff5e68..6851c45 100644
--- a/bin/game/main.lua
+++ b/bin/game/main.lua
@@ -53,17 +53,39 @@ local bitmap = nil
local sprs = {}
local animator = nil
local spr = nil
+local particle_sprite = nil
+local ps = nil
local function createAnimation(path, count, r, c, w, h, loop, speed)
local tex = jin.graphics.newTexture(path)
local ssheet = jin.graphics.newSpriteSheet(tex)
local sprs = ssheet:newSprites(count, r, c, w, h, 96, 168)
return jin.graphics.newAnimation(sprs, loop, speed)
end
-
+local Pi = 3.1415
+local tex = nil
function jin.core.onLoad()
-- bitmap = jin.graphics.newBitmap(200, 200, function(w, h, x, y)
-- return {255*math.sin(x/w),255 - 255,255*math.cos(y/w),255}
-- end)
+ tex = jin.graphics.newTexture("particle.png")
+ particle_sprite = jin.graphics.newSprite(tex, jin.graphics.SpriteOrigin.MIDDLECENTER)
+ ps = jin.graphics.newParticleSystem()
+
+ ps:setEmitRate(0.02);
+ ps:setEmitForce(80, 120);
+ ps:setEmitPosition({50, 50});
+ ps:setEmitDirection(-Pi / 10 - Pi / 2, Pi / 10 - Pi / 2);
+ ps:setParticleLinearAccelaration({0, 10});
+ ps:setParticleSpritesMode(jin.graphics.SpriteMode.SINGLE);
+ ps:setParticleColor({255, 30, 0, 255});
+ ps:addParticleTransparencyPoint(1, 0);
+ ps:addParticleTransparencyPoint(0, 0.5);
+ ps:enableParticleBlendAdditive(true);
+ ps:setParticleLife(0.5, 2);
+ ps:addParticleScalePoint(3, 0);
+ ps:addParticleScalePoint(0, 1);
+ ps:addParticleSprite(particle_sprite)
+
shader_program = jin.graphics.newShader(shader)
shader_program2 = jin.graphics.newShader(shader2)
local animation = createAnimation("anim2.png", 27, 3, 10, 200, 200, true, 50)
@@ -97,11 +119,12 @@ function jin.core.onEvent(e)
end
end
-function jin.core.onUpdate()
+function jin.core.onUpdate(dt)
tb.x = t
t = t + jin.time.getDelta()
animator:update(jin.time.getDelta())
timer:update(jin.time.getDelta())
+ ps:update(dt)
end
function jin.core.onDraw()
@@ -113,6 +136,7 @@ function jin.core.onDraw()
--jin.graphics.draw(sprs[2], 150, 150, 1, 1, 0)
local x, y = jin.mouse.getPosition()
animator:render(x, y, 1, 1, 0)
+ ps:render()
--jin.graphics.print(#sprs, 10, 10)
jin.graphics.draw(spr, 100, 200, 1, 1, 0)
--jin.graphics.useShader(shader_program2)
diff --git a/bin/game/particle.png b/bin/game/particle.png
new file mode 100644
index 0000000..632fcc1
--- /dev/null
+++ b/bin/game/particle.png
Binary files differ
diff --git a/bin/jin.exe b/bin/jin.exe
index 4e260c9..c74c8b7 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ