Skip to content

Commit 41bc45a

Browse files
Merge pull request #121 from Frostplays-ZERO/master
A few simple but massive things I wanted to add Includes pull request #123
2 parents 4132516 + 0bf69e7 commit 41bc45a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1562
-121
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0readme.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Various changes to graphics
2+
3+
"givesacoin" and "givescoinamount" for custom enemies, behaving kind of like givesalife but just for an amount of coins
4+
5+
"givestime" and "givestimeamount" for custom enemies, behaving similarly to givesacoin but for time (music may become jank, but whatever)
6+
7+
global booleans! can be read by entities and outputted to by collecting customenemies with "booloncollect", as well as read and written by animations.
8+
9+
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.
10+
11+
global integers! can be used in almost any way global booleans can, ~but for now are broken and shouldn't be.~
12+
13+
global integers hopefully work now?
14+
15+
added intoncollect:
16+
: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.
17+
18+
added outputting on transform:
19+
"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.
20+
21+
added playsound for animations.
22+
23+
added a couple sounds.
24+
25+
26+
27+
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
28+
29+
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.
30+
I may also add this to globinttrigger entities.
31+
32+
tile property #19 (next to foreground): 2x2.
33+
34+
fix: the lowtime sound can now only play once, usually.
35+
36+
...If anything about this is broken, help me fix it, please.
37+
38+
39+
40+
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
41+
42+
dialog boxes and textentities can now print globools, glints, and even built-in variables using the prefixes "gb:" "gi:" or "bi:"
43+
44+
also added the prefix "bb:" for a human-readable version of a globool... could not isolate crash on trying to update a textentity though
45+
46+
random fix: the intro now actually says CE for more than one frame
47+
48+
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
49+
50+
updated title image - do you like it? If you don't, you don't need to include it

animatedbooltimer.lua

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
animatedbooltimer = class("animatedbooltimer")
2+
animatedbooltimerlist = {}
3+
4+
function animatedbooltimer:init(x, y, tileno)
5+
self.x = x
6+
self.y = y
7+
self.quadi = 1
8+
self.timer = 0
9+
self.quadobj = tilequads[tileno]
10+
self.boolcheck = self.quadobj.boolid
11+
self.delays = self.quadobj.delays
12+
self.frametimes = {}
13+
self.length = 0
14+
for i = 1, #self.delays do
15+
self.length = self.length + self.delays[i]
16+
self.frametimes[i] = self.length
17+
end
18+
self.dir = 0
19+
self.oldbool = false
20+
table.insert(animatedbooltimerlist, self)
21+
end
22+
23+
function animatedbooltimer:update(dt)
24+
local oldi = self:geti()
25+
self.timer = self.timer + dt*self.dir
26+
27+
if self.timer > self.length then
28+
self.timer = self.length
29+
self.dir = 0
30+
elseif self.timer < 0 then
31+
self.timer = 0
32+
self.dir = 0
33+
end
34+
35+
local newbool = globoolSH(self.boolcheck, "check")
36+
if newbool ~= self.oldbool then
37+
self.oldbool = newbool
38+
self:input(newbool)
39+
end
40+
41+
local newi = self:geti()
42+
if oldi ~= newi then
43+
local oldcol = self.quadobj.properties[oldi].collision
44+
local oldportalable = self.quadobj.properties[oldi].portalable
45+
46+
local props = self.quadobj.properties[newi]
47+
48+
if oldcol ~= props.collision then
49+
if props.collision then
50+
objects["tile"][self.x .. "-" .. self.y] = tile:new(self.x-1, self.y-1)
51+
else
52+
objects["tile"][self.x .. "-" .. self.y] = nil
53+
checkportalremove(self.x, self.y)
54+
end
55+
end
56+
57+
if oldportalable ~= props.portalable then
58+
if not props.portalable then
59+
checkportalremove(self.x, self.y)
60+
end
61+
end
62+
end
63+
end
64+
65+
function animatedbooltimer:input(t)
66+
if t == true then
67+
self.dir = 1
68+
elseif t == false then
69+
self.dir = -1
70+
elseif t == "toggle" then
71+
self.dir = -self.dir
72+
73+
if self.dir == 0 then
74+
if self.timer == 0 then
75+
self.dir = 1
76+
else
77+
self.dir = -1
78+
end
79+
end
80+
end
81+
end
82+
83+
function animatedbooltimer:geti()
84+
for i = 2, #self.frametimes do
85+
if self.timer > self.frametimes[i-1] and self.timer <= self.frametimes[i] then
86+
return i
87+
end
88+
end
89+
90+
return 1
91+
end

animatedquad.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ function animatedquad:init(imgpath, s, number)
2323
if self.delays[1] == "triggered" then
2424
self.triggered = true
2525
table.remove(self.delays, 1)
26+
elseif self.delays[1] == "boolean" then
27+
self.boolean = true
28+
self.boolid = self.delays[2]
29+
table.remove(self.delays, 1)
30+
table.remove(self.delays, 1)
2631
else
2732
for i, v in ipairs(self.properties) do
2833
if self.props.collision ~= v.collision or self.props.portalable ~= v.portalable then
@@ -85,7 +90,7 @@ function animatedquad:update(dt)
8590
if self.quadi > #self.quadlist then
8691
self.quadi = 1
8792
end
88-
if objects and not self.triggered then
93+
if objects and not self.triggered and not self.boolean then
8994
self:updateproperties()
9095
end
9196
end
@@ -94,6 +99,8 @@ end
9499
function animatedquad:quad(x, y)
95100
if self.triggered and x and y and animatedtimers[x][y] then
96101
return self.quadlist[animatedtimers[x][y]:geti()]
102+
elseif self.boolean and x and y and animatedbooltimers[x][y] then
103+
return self.quadlist[animatedbooltimers[x][y]:geti()]
97104
else
98105
return self.quadlist[self.quadi]
99106
end
@@ -104,6 +111,10 @@ function animatedquad:getproperty(s, x, y)
104111
if self.properties[animatedtimers[x][y]:geti()] then
105112
return self.properties[animatedtimers[x][y]:geti()][s]
106113
end
114+
elseif self.boolean and x and y and animatedbooltimers[x] and animatedbooltimers[x][y] then
115+
if self.properties[animatedbooltimers[x][y]:geti()] then
116+
return self.properties[animatedbooltimers[x][y]:geti()][s]
117+
end
107118
end
108119
return self.props[s]
109120
end

animatedtimer.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ function animatedtimer:init(x, y, tileno)
1616
end
1717
self.dir = 0
1818

19+
1920
table.insert(animatedtimerlist, self)
2021
end
2122

2223
function animatedtimer:update(dt)
24+
25+
2326
local oldi = self:geti()
2427
self.timer = self.timer + dt*self.dir
2528

0 commit comments

Comments
 (0)