-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.lua
More file actions
553 lines (509 loc) · 26.9 KB
/
functions.lua
File metadata and controls
553 lines (509 loc) · 26.9 KB
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
require("main")
function file_exist(name)
local f = io.open(name, "r")
if f~=nil then
io.close(f)
return true
else
return false
end
end
function KeyInput()
if interacted == true then
else
if dDown == false then
if love.keyboard.isDown('a') then
aDown = true
for i = 1, collisionSize, 1 do
if playerX < collisions[i].x+worldX + collisions[i].width and playerY+PlayerH > collisions[i].y+worldY and playerY < collisions[i].y+worldY + collisions[i].hight then
if playerX+PlayerW > collisions[i].x+worldX then
if collisions[i].solid == false then
interactFunc(i)
else
worldX = worldX - playerSpeed
if debug == true then
print('left')
end
end
else
if aDown == true then
worldX = worldX + playerSpeed
aDown = false
end
end
else
if aDown == true then
worldX = worldX + playerSpeed
aDown = false
interactFalse()
end
end
end
else
if aDown == true then
worldX = worldX - playerSpeed
aDown = false
end
end
end
if aDown == false then
if love.keyboard.isDown('d') then
dDown = true
for i = 1, collisionSize, 1 do
if playerX+PlayerW > collisions[i].x+worldX and playerY+PlayerH > collisions[i].y+worldY and playerY < collisions[i].y+worldY + collisions[i].hight then
if playerX < collisions[i].x+worldX + collisions[i].width then
if collisions[i].solid == false then
interactFunc(i)
else
worldX = worldX + playerSpeed
if debug == true then
print('right')
end
end
else
if dDown == true then
worldX = worldX - playerSpeed
dDown = false
end
end
else
if dDown == true then
worldX = worldX - playerSpeed
dDown = false
interactFalse()
end
end
end
else
if dDown == true then
worldX = worldX + playerSpeed
dDown = false
end
end
end
if sDown == false then
if love.keyboard.isDown('w') then
wDown = true
for i = 1, collisionSize, 1 do
if playerX+PlayerW > collisions[i].x+worldX and playerY < collisions[i].y+worldY + collisions[i].hight and playerX < collisions[i].x+worldX + collisions[i].width then
if playerY+PlayerH > collisions[i].y+worldY then
if collisions[i].solid == false then
interactFunc(i)
else
worldY = worldY - playerSpeed
if debug == true then
print('up')
end
end
else
if wDown == true then
worldY = worldY + playerSpeed
wDown = false
end
end
else
if wDown == true then
worldY = worldY + playerSpeed
wDown = false
interactFalse()
end
end
end
else
if wDown == true then
worldY = worldY - playerSpeed
wDown = false
end
end
end
if wDown == false then
if love.keyboard.isDown('s') then
sDown = true
for i = 1, collisionSize, 1 do
if playerX+PlayerW > collisions[i].x+worldX and playerY+PlayerH > collisions[i].y+worldY and playerX < collisions[i].x+worldX + collisions[i].width then
if playerY < collisions[i].y+worldY + collisions[i].hight then
if collisions[i].solid == false then
interactFunc(i)
else
worldY = worldY + playerSpeed
if debug == true then
print('down')
end
end
else
if sDown == true then
worldY = worldY - playerSpeed
sDown = false
end
end
else
if sDown == true then
worldY = worldY - playerSpeed
sDown = false
interactFalse()
end
end
end
else
if sDown == true then
worldY = worldY + playerSpeed
sDown = false
end
end
end
end
if love.keyboard.isDown('q') then
coin_amount = coin_amount + 1
end
end
function loadMap()
map = {
{2,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2},
{2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
}
map2 = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
}
mapSize = #map*#map[1]
mapY = #map
mapX = mapSize/mapY
tileScale = 4
tileSize = 32*tileScale
collisionSize = 0
for y = 1, mapY, 1 do
for x = 1, mapX, 1 do
if map[y][x] == 1 then
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create((x*tileSize)-tileSize, (y*tileSize)-tileSize, tileSize,tileSize, true, collisionSize)
else
if map[y][x] == 0 then
else
if map[y][x] == 2 then
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create((x*tileSize)-tileSize, (y*tileSize)-tileSize, tileSize,tileSize, true, collisionSize)
end
end
end
end
end
for y = 1, mapY, 1 do
for x = 1, mapX, 1 do
if map2[y][x] == 0 then
else
if map2[y][x] == 1 then
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create((x*tileSize)-tileSize, (y*tileSize)-tileSize, tileSize,tileSize, true, collisionSize)
else
if map2[y][x] == 2 then
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create((x*tileSize)-tileSize, (y*tileSize)-tileSize, tileSize,tileSize, true, collisionSize)
else
if map2[y][x] == 3 then
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create((x*tileSize)-tileSize, (y*tileSize)-tileSize+44, tileSize,tileSize, true, collisionSize)
else
end
end
end
end
end
end
end
function drawMap()
for y = 1, mapY, 1 do
for x = 1, mapX, 1 do
if map[y][x] == 1 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(wall, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
else
if map[y][x] == 0 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(floor, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
else
if map[y][x] == 2 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(wallTop, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
end
end
end
end
end
end
function drawMap2()
for y = 1, mapY, 1 do
for x = 1, mapX, 1 do
if map2[y][x] == 0 then
else
if map2[y][x] == 1 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(FloorBed_top, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
else
if map2[y][x] == 2 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(FloorBed_bottom, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
else
if map2[y][x] == 3 then
love.graphics.setColor(1, 1, 1)
love.graphics.draw(wooden_box, worldX+(x*tileSize)-tileSize, worldY+(y*tileSize)-tileSize, 0, tileScale,tileScale)
else
end
end
end
end
end
end
end
function LoadTexture()
love.graphics.setDefaultFilter("nearest", "nearest")
floor = love.graphics.newImage("sprites/floor.png")
wall = love.graphics.newImage("sprites/wall.png")
wallTop = love.graphics.newImage("sprites/wallTop.png")
E_talk = love.graphics.newImage("sprites/E-talk.png")
speech_bubble = love.graphics.newImage("sprites/speech_bubble.png")
FloorBed_bottom = love.graphics.newImage("sprites/FloorBed_bottom.png")
FloorBed_top = love.graphics.newImage("sprites/FloorBed_top.png")
wooden_box = love.graphics.newImage("sprites/wooden_box.png")
coin_UI = love.graphics.newImage("sprites/coin.png")
MrLandlord_World = love.graphics.newImage("sprites/MrLandlord.png")
sladePainting_World = love.graphics.newImage("sprites/sladePaintingWall.png")
leatrixAlthoe_World = love.graphics.newImage("sprites/leatrix_althoe_map.png")
end
function loadNpcs()
currentNpc = 1
npcs[currentNpc] = npc.create(tileSize*6,tileSize*5,tileSize,tileSize, tileSize, 30, "sprites/leatrix_althoe_protriat.png", collisionSize + 1, "Sup.", "Hello!", leatrixAlthoe_World)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].x-npcs[currentNpc].talkSize, npcs[currentNpc].y-npcs[currentNpc].talkSize, npcs[currentNpc].width+(npcs[currentNpc].talkSize*2),npcs[currentNpc].hight+(npcs[currentNpc].talkSize*2), false, collisionSize)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].midXcol+30, npcs[currentNpc].midYcol, npcs[currentNpc].size-60, npcs[currentNpc].size, true, collisionSize)
currentNpc = 2
npcs[currentNpc] = npc.create(tileSize*5,tileSize*1,tileSize,tileSize, tileSize-80, 30, "sprites/TEST_charchter_red.png", collisionSize + 1, "Hey.", "Hello!", false)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].x-npcs[currentNpc].talkSize, npcs[currentNpc].y-npcs[currentNpc].talkSize, npcs[currentNpc].width+(npcs[currentNpc].talkSize*2),npcs[currentNpc].hight+(npcs[currentNpc].talkSize*2), false, collisionSize)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].midXcol, npcs[currentNpc].midYcol, npcs[currentNpc].size, npcs[currentNpc].size, true, collisionSize)
currentNpc = 3
npcs[currentNpc] = npc.create(tileSize*3,tileSize*3,tileSize,tileSize, tileSize, 30, "sprites/MrLandlord.png", collisionSize + 1, "Hello Im Mr. Landlord.", "Hello!", MrLandlord_World)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].x-npcs[currentNpc].talkSize, npcs[currentNpc].y-npcs[currentNpc].talkSize, npcs[currentNpc].width+(npcs[currentNpc].talkSize*2),npcs[currentNpc].hight+(npcs[currentNpc].talkSize*2), false, collisionSize)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].midXcol, npcs[currentNpc].midYcol, npcs[currentNpc].size, npcs[currentNpc].size, true, collisionSize)
currentNpc = 4
npcs[currentNpc] = npc.create(tileSize*2,tileSize*0,tileSize,tileSize, tileSize, 30, "sprites/sladePainting.png", collisionSize + 1, "This is the holy bard, Slade, who expired many centuries ago.\nHe was a writer of music and history, perhaps the most\n beloved musician in all the land.", "", sladePainting_World)
collisionSize = collisionSize + 1
collisions[collisionSize] = collision.create(npcs[currentNpc].x-npcs[currentNpc].talkSize, npcs[currentNpc].y-npcs[currentNpc].talkSize, npcs[currentNpc].width+(npcs[currentNpc].talkSize*2),npcs[currentNpc].hight+(npcs[currentNpc].talkSize*2), false, collisionSize)
end
function drawNpcs()
for i = 1, #npcs, 1 do
npcs[i]:draw()
end
end
function Ui()
love.graphics.draw(coin_UI, 0, 0, 0, 10)
love.graphics.print(":"..coin_amount, 80, -5, 0, 6)
end
function interactFunc(colI)
if debug == true then
print("inside")
end
for i = 1, #npcs, 1 do
if collisions[colI].collisionID == npcs[i].collisionQ then
if debug == true then
print("npc "..i)
end
npcs[i].playerNear = true
interact = true
end
end
end
function interactFalse()
interact = false
for i = 1, #npcs, 1 do
npcs[i].playerNear = false
end
end
function NpcTalk()
if interacted == true and npcs[1].playerNear == true then
currentNpc = 1
npcs[currentNpc].speechbubbleX = npcs[currentNpc].protraitX+5*npcs[currentNpc].protraitSize
npcs[currentNpc].speechbubbleY = npcs[currentNpc].protraitY+230*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonX = npcs[currentNpc].speechbubbleX+45*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonY = npcs[currentNpc].speechbubbleY+60*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonSizeX = 35*TextSize + npcs[currentNpc].buttonMorphX
npcs[currentNpc].buttonSizeY = 13*TextSize + npcs[currentNpc].buttonMorphY
love.graphics.draw(npcs[currentNpc].protrait, npcs[currentNpc].protraitX, npcs[currentNpc].protraitY, 0, npcs[currentNpc].protraitSize)
love.graphics.draw(speech_bubble, npcs[currentNpc].speechbubbleX, npcs[currentNpc].speechbubbleY, 0, speechBubbleSize)
love.graphics.setColor(1, 0.1, 0.1)
love.graphics.print(npcs[currentNpc].say, npcs[currentNpc].speechbubbleX+20*npcs[currentNpc].protraitSize, npcs[currentNpc].speechbubbleY+20*npcs[currentNpc].protraitSize, 0, TextSize*1.2)
if MouseX > npcs[currentNpc].buttonX and MouseX < npcs[currentNpc].buttonX+npcs[currentNpc].buttonSizeX and MouseY > npcs[currentNpc].buttonY and MouseY < npcs[currentNpc].buttonY+npcs[currentNpc].buttonSizeY then
love.graphics.setColor(0.7, 0.7, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
if MousePressed == true then
if npcs[currentNpc].stage == 1 then
npcs[currentNpc].say = "What's your name?"
npcs[currentNpc].buttonMorphX = 120
npcs[currentNpc].PlayerSay = " *Your Name*"
npcs[currentNpc].stage = 2
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 2 then
npcs[currentNpc].say = "Thats a cool name."
npcs[currentNpc].buttonMorphX = 10
npcs[currentNpc].PlayerSay = "Thanks"
npcs[currentNpc].stage = 3
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 3 then
npcs[currentNpc].say = "Oh wait can you help me with something!"
npcs[currentNpc].buttonMorphX = 190
npcs[currentNpc].PlayerSay = "What can I help with."
npcs[currentNpc].stage = 4
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 4 then
npcs[currentNpc].say = "I need 4 gold to pay my rent to Mr. Landlord."
npcs[currentNpc].buttonMorphX = 250
npcs[currentNpc].PlayerSay = "Ok I'll get you some gold."
npcs[currentNpc].stage = 5
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 5 then
npcs[currentNpc].say = "Thank you so much!"
npcs[currentNpc].buttonMorphX = 80
npcs[currentNpc].PlayerSay = "No problem."
npcs[currentNpc].stage = 6
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 6 then
npcs[currentNpc].say = "Come back with 4 cold."
if coin_amount >= 4 then
npcs[currentNpc].buttonMorphX = 140
npcs[currentNpc].PlayerSay = "Heres The Gold!"
npcs[currentNpc].stage = 7
else
npcs[currentNpc].buttonMorphX = 190
npcs[currentNpc].PlayerSay = "*Not Enough Gold!*"
npcs[currentNpc].stage = 6
update = true
end
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 7 then
npcs[currentNpc].say = "Thank you so much your so kind."
npcs[currentNpc].buttonMorphX = 80
npcs[currentNpc].PlayerSay = "No problem!"
npcs[currentNpc].stage = 7
love.timer.sleep(clickDelay)
else
end
end
end
end
end
end
end
end
else
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
end
love.graphics.setColor(0, 0, 0)
love.graphics.print(npcs[currentNpc].PlayerSay, npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, 0, TextSize*1.1)
if update == true then
if coin_amount >= 4 then
npcs[currentNpc].buttonMorphX = 140
npcs[currentNpc].PlayerSay = "Heres The Gold!"
npcs[currentNpc].stage = 7
update = false
else
npcs[currentNpc].buttonMorphX = 190
npcs[currentNpc].PlayerSay = "*Not Enough Gold!*"
npcs[currentNpc].stage = 6
end
end
end
if interacted == true and npcs[2].playerNear == true then
currentNpc = 2
npcs[currentNpc].speechbubbleX = npcs[currentNpc].protraitX+5*npcs[currentNpc].protraitSize
npcs[currentNpc].speechbubbleY = npcs[currentNpc].protraitY+230*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonX = npcs[currentNpc].speechbubbleX+45*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonY = npcs[currentNpc].speechbubbleY+60*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonSizeX = 50*TextSize
npcs[currentNpc].buttonSizeY = 13*TextSize
love.graphics.draw(npcs[currentNpc].protrait, npcs[currentNpc].protraitX, npcs[currentNpc].protraitY, 0, npcs[currentNpc].protraitSize)
love.graphics.draw(speech_bubble, npcs[currentNpc].speechbubbleX, npcs[currentNpc].speechbubbleY, 0, speechBubbleSize)
love.graphics.setColor(1, 0.1, 0.1)
love.graphics.print("Hey.", npcs[currentNpc].speechbubbleX+20*npcs[currentNpc].protraitSize, npcs[currentNpc].speechbubbleY+20*npcs[currentNpc].protraitSize, 0, TextSize*1.2)
if MouseX > npcs[currentNpc].buttonX and MouseX < npcs[currentNpc].buttonX+npcs[currentNpc].buttonSizeX and MouseY > npcs[currentNpc].buttonY and MouseY < npcs[currentNpc].buttonY+npcs[currentNpc].buttonSizeY then
love.graphics.setColor(0.7, 0.7, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
if MousePressed == true then
love.timer.sleep(0.1)
end
else
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
end
love.graphics.setColor(0, 0, 0)
love.graphics.print("hello", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, 0, TextSize*1.1)
end
if interacted == true and npcs[3].playerNear == true then
currentNpc = 3
npcs[currentNpc].speechbubbleX = npcs[currentNpc].protraitX+5*npcs[currentNpc].protraitSize
npcs[currentNpc].speechbubbleY = npcs[currentNpc].protraitY+230*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonX = npcs[currentNpc].speechbubbleX+45*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonY = npcs[currentNpc].speechbubbleY+60*npcs[currentNpc].protraitSize
npcs[currentNpc].buttonSizeX = 35*TextSize + npcs[currentNpc].buttonMorphX
npcs[currentNpc].buttonSizeY = 13*TextSize + npcs[currentNpc].buttonMorphY
love.graphics.draw(npcs[currentNpc].protrait, npcs[currentNpc].protraitX, npcs[currentNpc].protraitY-20, 0, npcs[currentNpc].protraitSize*10)
love.graphics.draw(speech_bubble, npcs[currentNpc].speechbubbleX, npcs[currentNpc].speechbubbleY, 0, speechBubbleSize)
love.graphics.setColor(1, 0.1, 0.1)
love.graphics.print(npcs[currentNpc].say, npcs[currentNpc].speechbubbleX+20*npcs[currentNpc].protraitSize, npcs[currentNpc].speechbubbleY+20*npcs[currentNpc].protraitSize, 0, TextSize*1.2)
if MouseX > npcs[currentNpc].buttonX and MouseX < npcs[currentNpc].buttonX+npcs[currentNpc].buttonSizeX and MouseY > npcs[currentNpc].buttonY and MouseY < npcs[currentNpc].buttonY+npcs[currentNpc].buttonSizeY then
love.graphics.setColor(0.7, 0.7, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
if MousePressed == true then
if npcs[currentNpc].stage == 1 then
npcs[currentNpc].say = "What's your name?"
npcs[currentNpc].buttonMorphX = 120
npcs[currentNpc].PlayerSay = " *Your Name*"
npcs[currentNpc].stage = 2
love.timer.sleep(clickDelay)
else
if npcs[currentNpc].stage == 2 then
npcs[currentNpc].say = "Thats a cool name."
npcs[currentNpc].buttonMorphX = 10
npcs[currentNpc].PlayerSay = "Thanks"
npcs[currentNpc].stage = 3
love.timer.sleep(clickDelay)
else
end
end
end
else
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, npcs[currentNpc].buttonSizeX, npcs[currentNpc].buttonSizeY)
end
love.graphics.setColor(0, 0, 0)
love.graphics.print(npcs[currentNpc].PlayerSay, npcs[currentNpc].buttonX, npcs[currentNpc].buttonY, 0, TextSize*1.1)
end
if interacted == true and npcs[4].playerNear == true then
currentNpc = 4
npcs[currentNpc].speechbubbleX = npcs[currentNpc].protraitX+5*npcs[currentNpc].protraitSize
npcs[currentNpc].speechbubbleY = npcs[currentNpc].protraitY+230*npcs[currentNpc].protraitSize
love.graphics.draw(npcs[currentNpc].protrait, npcs[currentNpc].protraitX, npcs[currentNpc].protraitY-20, 0, npcs[currentNpc].protraitSize*10)
love.graphics.draw(speech_bubble, npcs[currentNpc].speechbubbleX, npcs[currentNpc].speechbubbleY, 0, speechBubbleSize)
love.graphics.setColor(0, 0, 0)
love.graphics.print(npcs[currentNpc].say, npcs[currentNpc].speechbubbleX+20*npcs[currentNpc].protraitSize, npcs[currentNpc].speechbubbleY+20*npcs[currentNpc].protraitSize, 0, TextSize)
end
end