Skip to content

Commit

Permalink
Merge pull request #121 from Frostplays-ZERO/master
Browse files Browse the repository at this point in the history
A few simple but massive things I wanted to add
Includes pull request #123
  • Loading branch information
HugoBDesigner authored Oct 27, 2018
2 parents 4132516 + 0bf69e7 commit 41bc45a
Show file tree
Hide file tree
Showing 47 changed files with 1,562 additions and 121 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

50 changes: 50 additions & 0 deletions 0readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Various changes to graphics

"givesacoin" and "givescoinamount" for custom enemies, behaving kind of like givesalife but just for an amount of coins

"givestime" and "givestimeamount" for custom enemies, behaving similarly to givesacoin but for time (music may become jank, but whatever)

global booleans! can be read by entities and outputted to by collecting customenemies with "booloncollect", as well as read and written by animations.

usage of "booloncollect": booloncollect should be a string with the name of your boolean, and "boolactoncollect" should be one of {"true", "false", "flip"}, depending on what you want the output to be. Useful for animations.

global integers! can be used in almost any way global booleans can, ~but for now are broken and shouldn't be.~

global integers hopefully work now?

added intoncollect:
:intoncollect" should be a string with the name of your integer, "intactoncollect" should be one of {"add", "subtract", "set"}, and "intactvalue" should be a number, depending on what you want the output to be. Useful for red coins and stuff like that.

added outputting on transform:
"transfoutid" is the string with the name of your boolean/integer, "transfoutaction" is the action which is performed on the boolean/integer (any which is defined above), "transfoutvalue" should be an integer if you're outputting to an integer and false if you're outputting to a boolean, and "dontactuallytransform" can be set to true if you don't want the enemy to actually transform. there is no "outputsontransform" - transfoutid and transfoutaction serve that purpose.

added playsound for animations.

added a couple sounds.



planned features for next commit; more things to do with integers (such as using them in numinput for animations), more things with animated tiles (such as them triggering directly on global booleans), an example mappack

new random thing: animations now accept names of globints as numinput. it can also take a built-in variable such as marioworld or mariocoincount with the input "g:marioworld" or "g:mariocoincount". I think.
I may also add this to globinttrigger entities.

tile property #19 (next to foreground): 2x2.

fix: the lowtime sound can now only play once, usually.

...If anything about this is broken, help me fix it, please.



realised that global integers (or glints as they will now be referred to as) can store text, so officially supported that and may add more functions for it

dialog boxes and textentities can now print globools, glints, and even built-in variables using the prefixes "gb:" "gi:" or "bi:"

also added the prefix "bb:" for a human-readable version of a globool... could not isolate crash on trying to update a textentity though

random fix: the intro now actually says CE for more than one frame

integrated turretbot's MultiCustomTiles mod unsuccessfully - help me successfully integrate it and also add a dropdown for selecting between tilesets http://forum.stabyourself.net/viewtopic.php?f=13&t=4649

updated title image - do you like it? If you don't, you don't need to include it
91 changes: 91 additions & 0 deletions animatedbooltimer.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
animatedbooltimer = class("animatedbooltimer")
animatedbooltimerlist = {}

function animatedbooltimer:init(x, y, tileno)
self.x = x
self.y = y
self.quadi = 1
self.timer = 0
self.quadobj = tilequads[tileno]
self.boolcheck = self.quadobj.boolid
self.delays = self.quadobj.delays
self.frametimes = {}
self.length = 0
for i = 1, #self.delays do
self.length = self.length + self.delays[i]
self.frametimes[i] = self.length
end
self.dir = 0
self.oldbool = false
table.insert(animatedbooltimerlist, self)
end

function animatedbooltimer:update(dt)
local oldi = self:geti()
self.timer = self.timer + dt*self.dir

if self.timer > self.length then
self.timer = self.length
self.dir = 0
elseif self.timer < 0 then
self.timer = 0
self.dir = 0
end

local newbool = globoolSH(self.boolcheck, "check")
if newbool ~= self.oldbool then
self.oldbool = newbool
self:input(newbool)
end

local newi = self:geti()
if oldi ~= newi then
local oldcol = self.quadobj.properties[oldi].collision
local oldportalable = self.quadobj.properties[oldi].portalable

local props = self.quadobj.properties[newi]

if oldcol ~= props.collision then
if props.collision then
objects["tile"][self.x .. "-" .. self.y] = tile:new(self.x-1, self.y-1)
else
objects["tile"][self.x .. "-" .. self.y] = nil
checkportalremove(self.x, self.y)
end
end

if oldportalable ~= props.portalable then
if not props.portalable then
checkportalremove(self.x, self.y)
end
end
end
end

function animatedbooltimer:input(t)
if t == true then
self.dir = 1
elseif t == false then
self.dir = -1
elseif t == "toggle" then
self.dir = -self.dir

if self.dir == 0 then
if self.timer == 0 then
self.dir = 1
else
self.dir = -1
end
end
end
end

function animatedbooltimer:geti()
for i = 2, #self.frametimes do
if self.timer > self.frametimes[i-1] and self.timer <= self.frametimes[i] then
return i
end
end

return 1
end
13 changes: 12 additions & 1 deletion animatedquad.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ function animatedquad:init(imgpath, s, number)
if self.delays[1] == "triggered" then
self.triggered = true
table.remove(self.delays, 1)
elseif self.delays[1] == "boolean" then
self.boolean = true
self.boolid = self.delays[2]
table.remove(self.delays, 1)
table.remove(self.delays, 1)
else
for i, v in ipairs(self.properties) do
if self.props.collision ~= v.collision or self.props.portalable ~= v.portalable then
Expand Down Expand Up @@ -85,7 +90,7 @@ function animatedquad:update(dt)
if self.quadi > #self.quadlist then
self.quadi = 1
end
if objects and not self.triggered then
if objects and not self.triggered and not self.boolean then
self:updateproperties()
end
end
Expand All @@ -94,6 +99,8 @@ end
function animatedquad:quad(x, y)
if self.triggered and x and y and animatedtimers[x][y] then
return self.quadlist[animatedtimers[x][y]:geti()]
elseif self.boolean and x and y and animatedbooltimers[x][y] then
return self.quadlist[animatedbooltimers[x][y]:geti()]
else
return self.quadlist[self.quadi]
end
Expand All @@ -104,6 +111,10 @@ function animatedquad:getproperty(s, x, y)
if self.properties[animatedtimers[x][y]:geti()] then
return self.properties[animatedtimers[x][y]:geti()][s]
end
elseif self.boolean and x and y and animatedbooltimers[x] and animatedbooltimers[x][y] then
if self.properties[animatedbooltimers[x][y]:geti()] then
return self.properties[animatedbooltimers[x][y]:geti()][s]
end
end
return self.props[s]
end
3 changes: 3 additions & 0 deletions animatedtimer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ function animatedtimer:init(x, y, tileno)
end
self.dir = 0


table.insert(animatedtimerlist, self)
end

function animatedtimer:update(dt)


local oldi = self:geti()
self.timer = self.timer + dt*self.dir

Expand Down
Loading

1 comment on commit 41bc45a

@RokonShimo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at these 1,500 lines of code, it's really dawning on me just how much I did (along with everyone else who contributed a mod merged into this). You probably won't see me for a while, what with school and all - this is taking too much of my time.

Please sign in to comment.