-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathcharacters.lua
690 lines (620 loc) · 20.5 KB
/
characters.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
--I have no idea what i'm even doing
local animfiles = {"", "big", "fire", "ice", "superball", "hammer", "frog", "raccoon", "tiny", "tanooki", "skinny", "cape", "shell", "boomerang"}
local blankimg = love.graphics.newImage(love.image.newImageData(1, 1))
local splitimage
function loadcustomplayers()
characters = {list = {}, data = {}}
local dir = love.filesystem.getDirectoryItems("alesans_entities/characters")
-- mount zips
for i, v in ipairs(dir) do
if v:sub(-4, -1) == ".zip" then
mountto("alesans_entities/characters/" .. v, "alesans_entities/characters")
end
end
-- refresh with new mounted items
dir = love.filesystem.getDirectoryItems("alesans_entities/characters")
-- load characters
for i, v in ipairs(dir) do
local folder = "alesans_entities/characters/" .. v
if love.filesystem.getInfo(folder .. "/config.json") then
local playerstuff = {
--identification
name = v,
i = #characters["list"]+1,
--colors
colorables = {"hat", "hair", "skin"},
colors = {},
defaultcolors = false,
starcolors = starcolors,
flowercolor = false,
hammersuitcolor = false,
frogsuitcolor = false,
leafcolor = false,
iceflowercolor = false,
tanookisuitcolor = false,
statuecolor = statuecolor,
superballcolor = false,
blueshellcolor = false,
boomerangcolor = false,
--hats
hats = false,
--stats
walkacceleration = walkacceleration,
runacceleration = runacceleration,
walkaccelerationair = walkaccelerationair,
runaccelerationair = runaccelerationair,
minspeed = minspeed,
frogminspeed = frogminspeed,
frogfriction = frogfriction,
maxwalkspeed = maxwalkspeed,
maxrunspeed = maxrunspeed,
friction = friction,
superfriction = superfriction,
frictionair = frictionair,
airslidefactor = airslidefactor,
icefriction = icefriction,
icewalkacceleration = icewalkacceleration,
icerunacceleration = icerunacceleration,
gelmaxrunspeed = gelmaxrunspeed,
gelmaxwalkspeed = gelmaxwalkspeed,
gelrunacceleration = gelrunacceleration,
gelwalkacceleration = gelwalkacceleration,
bluegelminforce = bluegelminforce,
fencespeed = fencespeed,
idleanimationspeed = idleanimationspeed,
runanimationspeed = runanimationspeed,
jumpanimationspeed = 8,
jumpanimationloop = false,
fallanimationspeed = 8,
fallanimationloop = false,
piperunanimationspeed = piperunanimationspeed,
swimanimationspeed = swimanimationspeed,
fenceanimationspeed = fenceanimationspeed,
vineframedelay = vineframedelay,
yacceleration = yacceleration,
yaccelerationjumping = yaccelerationjumping,
tinymariogravity = tinymariogravity,
tinymariogravityjumping = tinymariogravityjumping,
skinnymariogravity = skinnymariogravity,
jumpforce = jumpforce,
jumpforceadd = jumpforceadd,
raccoonjumpforce = raccoonjumpforce,
raccoonjumpforceadd = raccoonjumpforceadd,
raccoonflyjumpforce = raccoonflyjumpforce,
raccoonflytime = raccoonflytime,
capejumpforce = capejumpforce,
passivespeed = passivespeed,
uwwalkacceleration = uwwalkacceleration,
uwrunacceleration = uwrunacceleration,
uwwalkaccelerationair = uwwalkaccelerationair,
uwmaxairwalkspeed = uwmaxairwalkspeed,
uwmaxairshellwalkspeed = uwmaxairshellwalkspeed,
uwmaxwalkspeed = uwmaxwalkspeed,
uwmaxrunspeed = uwmaxrunspeed,
uwfriction = uwfriction,
uwsuperfriction = uwsuperfriction,
uwfrictionair = uwfrictionair,
uwairslidefactor = uwairslidefactor,
uwjumpforce = uwjumpforce,
uwjumpforceadd = uwjumpforceadd,
uwyacceleration = uwyacceleration,
uwyaccelerationjumping = uwyaccelerationjumping,
waterjumpforce = waterjumpforce,
--abilities
fireenemy = false,
smallducking = false,
breaksblockssmall = false,
skid = false,
groundpound = false,
doublejump = false,
--frames (anything that is quoted out doesn't work)
idleframes = 1,
runframes = 3,
jumpframes = 1,
fallframes = 0,
customframes = 0,
swimframes = 4,
climbframes = 2,
swimpushframes = 0,
fenceframes = 0,
smallduckingframes = 0,
groundpoundframes = 0,
--carryingframes = 0,
--carryingwalkingframes = 0,
--carryingjumpframes = 0,
--grabbingframes = 0,
--wallslideframes = 0,
--spinjumpframes = 0,
blueshellframes = 4,
shoeframes = 0,
--yoshiframes = 0,
nopointing = false,
portalgunoverlay = false, --paste an image of a portal gun on top of character
portalgununderhat = false,
nojumpsound = false,
--powerup/health
defaultsize = false,
health = false,--3,
--graphics positioning
smalloffsetX = 6,
smalloffsetY = 3,
smallquadcenterX = 11,
smallquadcenterY = 10,
smallquadwidth = 20,
smallquadheight = 20,
smallimgwidth = 300,
smallimgheight = 100,
shrinkquadcenterX = 9,
shrinkquadcenterY = 32,
shrinkoffsetY = -3,
shrinkquadcenterY2 = 16,
growquadwidth = 20,
growquadheight = 24,
growquadcenterY = 16,
growquadcenterY2 = 10,
bigquadcenterY = 20,
bigquadcenterX = 9,
bigoffsetY = -3,
bigoffsetX = 6,
bigquadwidth = 20,
bigquadheight = 36,
bigimgwidth = 280,
bigimgheight = 180,
duckquadcenterY = 26,
duckoffsetY = 3,
hammerquadcenterY = 20,
hammerquadcenterX = 9,
hammeroffsetY = -3,
hammeroffsetX = 6,
hammerquadwidth = 20,
hammerquadheight = 36,
hammerimgwidth = 280,
hammerimgheight = 180,
frogquadcenterY = 24,
frogquadcenterX = 9,
frogoffsetY = -1,
frogoffsetX = 6,
frogquadwidth = 20,
frogquadheight = 36,
frogimgwidth = 280,
frogimgheight = 180,
raccoonquadcenterY = 20,
raccoonquadcenterX = 14,
raccoonoffsetY = -3,
raccoonoffsetX = 6,
raccoonquadwidth = 26,
raccoonquadheight = 36,
raccoonimgwidth = 624,
raccoonimgheight = 180,
raccoonhatoffsetX = -5,--added to the hat offset with raccon or tanooki
raccoonhatspinoffsetX = -1,--added to the hat offset when spinning
hugeoffsetX = 18,
hugeoffsetY = -41,
hugequadcenterX = 9,
hugequadcenterY = 20,
hugeclassicoffsetX = 12,
hugeclassicoffsetY = -1,
hugeclassicquadcenterX = 11,
hugeclassicquadcenterY = 10,
hugeclassicduckquadcenterY = 22,
hugeclassicduckoffsetY = 7,
capequadwidth = 34,
capequadheight = 36,
capeimgwidth = 884,
capeimgheight = 180,
capequadcenterY = 20,
capequadcenterX = 17,
capeoffsetY = -3,
capeoffsetX = 6,
capehatoffsetX = -8, --added to the hat offset with cape powerup
--these are specifically for the cape image
capeimgoffsetX = 0,
capeimgoffsetY = 0,
capeimgduckingoffsetY = -6,
capeimgfenceoffsetX = -9,
capeimgfireenemyoffsetX = 8,
tinyoffsetX = 3,
tinyoffsetY = 4,
tinyquadcenterX = 5,
tinyquadcenterY = 6,
tinyquadwidth = 10,
tinyquadheight = 10,
tinyimgwidth = 150,
tinyimgheight = 50,
shellquadcenterY = 20,
shellquadcenterX = 9,
shelloffsetY = -3,
shelloffsetX = 6,
shellquadwidth = 20,
shellquadheight = 36,
shellimgwidth = 400,
shellimgheight = 180,
boomerangquadcenterY = 20,
boomerangquadcenterX = 9,
boomerangoffsetY = -3,
boomerangoffsetX = 6,
boomerangquadwidth = 20,
boomerangquadheight = 36,
boomerangimgwidth = 340,
boomerangimgheight = 180,
--helmet offsets
helmetoffsetX = -3,
helmetoffsetY = 7,
helmetbigoffsetX = 3,
helmetcapeoffsetX = -4,
helmetraccoonoffsetX = -1,
helmetfrogoffsetX = -2,
helmetfrogoffsetY = -2,
helmetskinnyoffsetX = -3,
helmetskinnyoffsetY = 7,
helmettinyoffsetX = 4,
helmettinyoffsetY = 9,
helmetspinoffsetX = -2, --added to the offset when spinning
propellerhelmetoffsetX = 0,--added to offset when wearing propeller box
propellerhelmetoffsetY = 4,
cannonhelmetoffsetX = 0,--added to offset when wearing cannon box
cannonhelmetoffsetY = 1,
--shoe offsets
smallyoshioffsetY = 9,
bigyoshioffsetY = 5,
hugeyoshioffsetY = -12,
tinyyoshioffsetY = 12,
hugeclassicyoshioffsetY = 14,
yoshiimgoffsetY = 36, --yoshi's sprite offset
yoshiimghugeoffsetY = 64,
yoshiwalkoffsets = {1, 2, 0},
yoshiskinnyoffsetY = -6, --mario's sprite offset when on yoshi
yoshitinyoffsetY = -4,
smallshoeoffsetY = 7,
bigshoeoffsetY = -5,
hugeshoeoffsetY = -12,
tinyshoeoffsetY = 12,
hugeclassicshoeoffsetY = 14,
shoeimgoffsetY = 23,
shoeimghugeoffsetY = 43,
shoeimghugeclassicoffsetY = 38,
cloudimgoffsetY = 23,
cloudimghugeoffsetY = 43,
cloudimghugeclassicoffsetY = 38,
drybonesshellimgoffsetY = 23,
drybonesshellimghugeoffsetY = 43,
drybonesshellimghugeclassicoffsetY = 38,
drybonesshellimgduckingoffsetY = 8, --added to offsetY when ducking in drybones shell
drybonesshellimghugeclassicduckingoffsetY = -8,
drybonesshellimghugeduckingoffsetY = 8,
}
playerstuff.imgs = {} --list of imgs
--load properties
local s = love.filesystem.read(folder .. "/config.json")
JSONcrashgame = false
local temp
local suc, err = pcall(function() return JSON:decode(s) end)
if suc then
temp = err
--works! so set properties
for i, v in pairs(temp) do
-- set properties
playerstuff[i] = v
if i == "health" or i == "fireenemy" then
playerstuff["advanced"] = true
end
end
else
jsonerrorwindow:open("CHARACTER JSON ERROR! (" .. v .. ".json)", JSONerror[2],
function()
loadcustomplayers()
resetcustomplayers()
end)
JSONcrashgame = true
end
if playerstuff.fireenemy and type(playerstuff.fireenemy) == "table" then
for i, v in pairs(playerstuff.fireenemy) do
local a = i:lower()
if type(v) == "string" then
playerstuff.fireenemy[a] = v:lower()
else
playerstuff.fireenemy[a] = v
end
end
end
for i2, n in pairs(animfiles) do
local n = n .. "animations"
if love.filesystem.getInfo(folder .. "/" .. n .. ".png") or love.filesystem.getInfo(folder .. "/" .. n .. "1.png") then
playerstuff.imgs[n] = true
end
end
--check if for the right version
if playerstuff.version then
local vs = playerstuff.version
if vs and vs > VERSION then
if math.abs(vs-VERSION) < 0.1 then
notice.new(v .. " was made for a\nnew patch of mari0 ae\ndownload the new version", notice.white, 4.5)
else
notice.new(v .. " was made for a\nnewer version of mari0 ae\ndownload the new version!", notice.red, 8)
end
end
end
characters.data[v] = playerstuff
table.insert(characters["list"], v)
--create animations0.png animations1.png
if playerstuff.splitmissingimages and playerstuff.writefiles then
local i = v
local imgs = characters.data[i].imgs
if not characters.data[i]["animations"] then
for i2, v in pairs(animfiles) do
local n = v .. "animations"
if imgs[n] and not love.filesystem.getInfo(folder .. "/" .. n .. "1.png") then
characters.data[i][n] = {}
local img = love.image.newImageData("alesans_entities/characters/" .. i .. "/" .. n .. ".png")
local imgdata = splitimage(img, characters.data[i].splitcolors, true, "imagedata")
imgdata:encode("png", "alesans_entities/characters/" .. i .. "/" .. n .. "0.png")
for j = 1, #characters.data[i].colorables do
imgdata = splitimage(img, characters.data[i].splitcolors[j], nil, "imagedata")
imgdata:encode("png", "alesans_entities/characters/" .. i .. "/" .. n .. j .. ".png")
end
end
end
end
end
end
end
end
function resetcustomplayers()
for i = 1, #mariocharacter do
if mariocharacter[i] then
setcustomplayer(mariocharacter[i], i, "initial")
end
end
end
---@param img love.ImageData
---@param color table
---@param exclude boolean?
---@param imagedata boolean?
local function _splitimageshaders(img, color, exclude, imagedata)
if not splitShader then
splitShader = love.graphics.newShader[[
uniform Image inputImage;
uniform vec3 splitColor;
#ifdef VERTEX
vec4 position( mat4 transform_projection, vec4 vertex_position )
{
return transform_projection * vertex_position;
}
#endif
#ifdef PIXEL
vec4 effect( vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords )
{
vec4 texcolor = Texel(inputImage, texture_coords);
if (abs(texcolor.r-splitColor.r) > 0.01 || abs(texcolor.g-splitColor.g) > 0.01 || abs(texcolor.b-splitColor.b) > 0.01)
{ discard; }
return vec4(1.0,1.0,1.0,1.0);
}
#endif
]]
end
local drawable = love.graphics.newImage(img)
local output = love.graphics.newCanvas(drawable:getWidth(), drawable:getHeight())
if exclude then
local outputdata = output:newImageData()
return love.graphics.newImage(outputdata)
end
local c = love.graphics.getCanvas()
love.graphics.setCanvas(output)
love.graphics.setShader(splitShader)
splitShader:send("inputImage", drawable)
splitShader:send("splitColor", {color[1]/255,color[2]/255,color[3]/255})
love.graphics.draw(drawable,0,0)
love.graphics.setShader()
love.graphics.setCanvas(c)
local outputdata = output:newImageData()
return love.graphics.newImage(outputdata)
end
---@param img love.ImageData
---@param color table
---@param exclude boolean?
---@param imagedata boolean?
local function _splitimageffi(img, color, exclude, imagedata)
local output = img:clone()
local pointer = require("ffi").cast("uint8_t*", output:getFFIPointer()) -- imageData has one byte per channel per pixel.
local bytecount = output:getWidth() * output:getHeight() -- pixel count * 4
for i = 0, 4*bytecount-1, 4 do
local r, g, b, a = pointer[i], pointer[i+1], pointer[i+2], pointer[i+3]
local place = false
if exclude then
place = true
for _, c in pairs(color) do
if r == c[1] and g == c[2] and b == c[3] then
place = false
break
end
end
else
if r == color[1] and g == color[2] and b == color[3] then
place = true
end
end
if place then
-- if exclude, values remain the same, so no need to do anything
if not exclude then
pointer[i] = 255
pointer[i+1] = 255
pointer[i+2] = 255
pointer[i+3] = a
end
else
pointer[i] = 0
pointer[i+1] = 0
pointer[i+2] = 0
pointer[i+3] = 0
end
end
if imagedata then
return output
else
return love.graphics.newImage(output)
end
end
---@param img love.ImageData
---@param color table
---@param exclude boolean?
---@param imagedata boolean?
local function _splitimagenative(img, color, exclude, imagedata)
local output = img:clone()
output:mapPixel(function(_, _, r, g, b, a)
local place = false
if exclude then
place = true
for _, c in pairs(color) do
if r == c[1] and g == c[2] and b == c[3] then
place = false
break
end
end
else
if r == color[1] and g == color[2] and b == color[3] then
place = true
end
end
if place then
if exclude then
return nil -- leaves value (r,g,b,a) unchanged
else
return 255, 255, 255, a
end
end
return 0, 0, 0, 0
end)
if imagedata then
return output
else
return love.graphics.newImage(output)
end
end
---@param img love.ImageData
---@param color table
---@param exclude boolean?
---@param imagedata boolean?
function splitimage(img, color, exclude, imagedata) --split singe image into colorable images
if false then --useShader then
return _splitimageshaders(img, color, exclude, imagedata)
elseif FFIAVAILABLE then
return _splitimageffi(img, color, exclude, imagedata)
else
return _splitimagenative(img, color, exclude, imagedata)
end
end
function setcustomplayer(i, pn, initial) --name, player number, initial (don't change colors to defaults)
if i and characters.data[i] then
if love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/config.txt") then
--incompatible probably
if love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/animationsBAK.png") then --SE Character
notice.new("Incompatible Character Detected\nUse characters made for mari0:AE!", notice.red, 5)
elseif not love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/config.json") then --Old Character Format
notice.new("Incompatible Character Detected\nUse characters made for\nmari0:AE version " .. VERSIONSTRING .. "!", notice.red, 5)
end
end
local imgs = characters.data[i].imgs
if not characters.data[i]["animations"] then
for i2, v in pairs(animfiles) do
local n = v .. "animations"
if imgs[n] then
characters.data[i][n] = {}
if #characters.data[i].colors == #characters.data[i].colorables and not characters.data[i].dontsplitcolors then
local img = love.image.newImageData("alesans_entities/characters/" .. i .. "/" .. n .. ".png")
characters.data[i][n][0] = splitimage(img, characters.data[i].colors, true)
for j = 1, #characters.data[i].colorables do
characters.data[i][n][j] = splitimage(img, characters.data[i].colors[j])
end
elseif love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/" .. n .. "1.png") then
for j = 0, #characters.data[i].colorables do
if not love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/" .. n .. j .. ".png") then
characters.data[i][n][j] = blankimg
else
characters.data[i][n][j] = love.graphics.newImage("alesans_entities/characters/" .. i .. "/" .. n .. j .. ".png")
end
end
else
characters.data[i][n][0] = love.graphics.newImage("alesans_entities/characters/" .. i .. "/" .. n .. ".png")
for j = 1, #characters.data[i].colorables do
characters.data[i][n][j] = blankimg
end
end
elseif v ~= "fire" and v ~= "ice" and v ~= "superball" then
characters.data[i][n] = characters.data["mario"][n]--_G["mario" .. n]
end
end
--cape and bunnyears
if love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/cape.png") then
characters.data[i].capeimg = love.graphics.newImage("alesans_entities/characters/" .. i .. "/cape.png")
end
if love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/bunnyears.png") then
characters.data[i].bunnyears = love.graphics.newImage("alesans_entities/characters/" .. i .. "/bunnyears.png")
end
--health counter
if love.filesystem.getInfo("alesans_entities/characters/" .. i .. "/health.png") then
local img = love.graphics.newImage("alesans_entities/characters/" .. i .. "/health.png")
characters.data[i].healthimg = img
local w, h = img:getWidth(), img:getHeight()
local t = {}
for y = 1, 2 do
table.insert(t, love.graphics.newQuad(0, (h/2)*(y-1), w, h/2, w, h))
end
characters.data[i].healthquad = t
end
end
if not characters.data[i]["quads"] then
loadplayerquads(characters.data[i])
end
if characters.data[i].defaultcolors and characters.data[i].defaultcolors[pn] then
if (not initial) or (mariocolors[pn] and #mariocolors[pn] < #characters.data[i].defaultcolors[pn]) then
--this doesn't work correctly
--for some reason the number of mario colors is always 4
--i dont fuckin know
--print(initial, #mariocolors[pn], #characters.data[i].defaultcolors[pn])
if #characters.data[i].defaultcolors[pn] >= #characters.data[i].colorables then
for j = 1, #characters.data[i].colorables do
if characters.data[i].defaultcolors[pn][j] then
mariocolors[pn][j] = shallowcopy(characters.data[i].defaultcolors[pn][j])
else
print("missing colorable:" .. j)
end
end
end
if characters.data[i].defaulthat and not initial then
local hat = characters.data[i].defaulthat
if hat == 0 then
hat = nil
end
mariohats[pn] = {hat}
end
end
end
if characters.data[i].fireenemy then
enemies_load()
end
if pn == 1 then
playername = characters.data[i].name or "character"
end
mariocharacter[pn] = i
return true
else
setcustomplayer("mario", pn, initial)
return false
end
end
function customplayerhatoffsets(i, targettable, anim, frame)
--target table is hatoffsets, bighatoffsets, skinnyhatoffsets
if i and characters.data[i] and characters.data[i][targettable] then
if characters.data[i][targettable][anim] then
if frame and type(characters.data[i][targettable][anim]) == "table" and characters.data[i][targettable][anim][frame] and type(characters.data[i][targettable][anim][frame]) == "table" then
return characters.data[i][targettable][anim][frame]
end
return characters.data[i][targettable][anim]
end
end
return false
end
--[[function getplayer() --sets abilities and sprites
playerstuff = { playername, jumpheight, speed, grip(friction)}
playerabilities = {raccoon}
end]]