Skip to content

Commit 7424a1e

Browse files
authored
Merge pull request #23 from gabbelitoV2/master
created the viola Scene
2 parents 9cbde16 + 8ccf444 commit 7424a1e

6 files changed

Lines changed: 162 additions & 1 deletion

File tree

assets.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@
277277
resDoris.addFile({'dir': '90.DXR', 'lib': 'Internal', 'num': '200-202'}) # Speech
278278
MulleResources.append(resDoris)
279279

280+
resViola = MulleResource('viola')
281+
resViola.addFile({'dir': '89.DXR', 'lib': 'Internal', 'num': 1}) # Background
282+
resViola.addFile({'dir': '89.DXR', 'lib': 'Internal', 'num': '18-20'}) # Viola animation
283+
resViola.addFile({'dir': '89.DXR', 'lib': 'Internal', 'num': 177}) # Audio
284+
resViola.addFile({'dir': '89.DXR', 'lib': 'Internal', 'num': '200-202'}) # Audio
285+
MulleResources.append(resViola)
286+
280287
if not sys.argv[2]:
281288
assetOutPath = "./dist/assets"
282289
else:

build_scripts/data/director_data.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@
215215
'94.DXR': {'folder': 'Internal', 'opaque': [200]},
216216
'CDDATA.CXT': {'folder': 'Standalone', 'opaque': [[629, 658]]},
217217
'PLUGIN.CST': {'folder': 'Standalone', 'opaque': [18]},
218+
'89.DXR': { # Viola
219+
'file': '89.DXR',
220+
'folder': 'Internal',
221+
'range_sv': {
222+
'background': 1,
223+
'animation': [18, 20],
224+
'audio': [177, 177, 200, 202]
225+
},
226+
'opaque': [1],
227+
'identical': [[1, 1], [18, 20], [177, 177], [200, 202]],
228+
},
218229
}
219230

220231

data/subtitles/english/viola.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"89d001v0": {
3+
"lines": [
4+
"- Hi Mulle!",
5+
"- How nice of you to stop by."
6+
],
7+
"actor": "viola"
8+
},
9+
"89d002v0": {
10+
"lines": [
11+
"- Thanks for your help!",
12+
"- Now I can continue with my work."
13+
],
14+
"actor": "viola"
15+
},
16+
"89d003v0": {
17+
"lines": [
18+
"- Of course!",
19+
"- Always happy to help."
20+
],
21+
"actor": "mulle"
22+
}
23+
}

progress/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ <h2>Features</h2>
386386
<li>
387387
<span class="section">89.DXR - Viola</span>
388388
<ul>
389-
<li>Scene</li>
389+
<li class="functional">Scene</li>
390390
</ul>
391391
</li>
392392

src/game.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import StureStortandState from 'scenes/sturestortand'
2828
import SaftfabrikState from 'scenes/saftfabrik'
2929
import SolhemState from 'scenes/solhem'
3030
import DorisDigitalState from 'scenes/dorisdigital'
31+
import ViolaState from 'scenes/viola'
3132

3233
// var requireScenes = require.context('scenes', true, /\.js$/);
3334
// requireScenes.keys().forEach(requireScenes);
@@ -152,6 +153,7 @@ class MulleGame extends Phaser.Game {
152153
sturestortand: StureStortandState, // 88
153154
dorisdigital: DorisDigitalState, // 90
154155
figgeferrum: FiggeFerrumState, // 92
156+
viola: ViolaState, // 89
155157

156158
carshow: CarShowState // 94
157159

src/scenes/viola.js

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import MulleState from './base'
2+
3+
import MulleSprite from '../objects/sprite'
4+
import MulleBuildCar from '../objects/buildcar'
5+
import MulleActor from '../objects/actor'
6+
import blinkThing from '../util/blinkThing'
7+
import SubtitleLoader from '../objects/SubtitleLoader'
8+
9+
class ViolaState extends MulleState {
10+
preload () {
11+
super.preload()
12+
this.game.load.pack('viola', 'assets/viola.json', null, this)
13+
this.subtitles = new SubtitleLoader(this.game, 'viola', ['english'])
14+
this.subtitles.preload()
15+
}
16+
17+
create () {
18+
super.create()
19+
20+
this.game.mulle.addAudio('viola')
21+
this.subtitles.load()
22+
23+
// Play background sound
24+
this.game.mulle.playAudio('89e001v0')
25+
26+
// Background
27+
var background = new MulleSprite(this.game, 320, 240)
28+
background.setDirectorMember('89.DXR', 1)
29+
this.game.add.existing(background)
30+
31+
// The car (without Salka/Mulle)
32+
this.car = new MulleBuildCar(this.game, 445, 370, null, false, false)
33+
this.game.add.existing(this.car)
34+
35+
// Buffa with animation
36+
var buffa = new MulleActor(this.game, 360, 320, 'buffa')
37+
buffa.setDirectorMember('00.CXT', 214)
38+
this.game.add.existing(buffa)
39+
this.game.mulle.actors.buffa = buffa
40+
41+
let animationCount = 0
42+
let isWaiting = false
43+
let buffaTimer = this.game.time.events.loop(150, () => {
44+
if (!isWaiting && animationCount < 8) {
45+
buffa.animations.play('scratch1', null, false)
46+
buffa.animations.currentAnim.onComplete.addOnce(() => {
47+
buffa.setDirectorMember('00.CXT', 214)
48+
animationCount++
49+
50+
if (animationCount >= 8) {
51+
isWaiting = true
52+
this.game.time.events.add(3000, () => {
53+
animationCount = 0
54+
isWaiting = false
55+
})
56+
}
57+
})
58+
}
59+
})
60+
61+
// Viola in the window
62+
var viola = new MulleSprite(this.game, 246, 154)
63+
viola.setDirectorMember('89.DXR', 18)
64+
this.game.add.existing(viola)
65+
66+
// Window animation
67+
let frame = 18
68+
let animationTimer = this.game.time.events.loop(300, () => {
69+
frame++
70+
if (frame > 20) {
71+
frame = 18
72+
}
73+
viola.setDirectorMember('89.DXR', frame)
74+
})
75+
76+
// Show the tank directly with correct properties
77+
var tank = new MulleSprite(this.game, 2, 332)
78+
tank.setDirectorMember('CDDATA.CXT', 436)
79+
tank.partId = 172
80+
tank.properties = {
81+
Weight: 4,
82+
Color: 1,
83+
Funnyfactor: 5
84+
}
85+
tank.requires = ['#b1']
86+
tank.covers = ['#a5', '#a6', '#a7', '#b1']
87+
this.game.add.existing(tank)
88+
89+
// Play the dialogs one after another
90+
this.game.mulle.playAudio('89d001v0', () => {
91+
this.game.mulle.playAudio('89d003v0', () => {
92+
this.game.mulle.user.Junk.yard[172] = {
93+
x: this.game.rnd.integerInRange(290, 580),
94+
y: 440
95+
}
96+
97+
this.game.time.events.remove(buffaTimer)
98+
buffa.animations.stop()
99+
100+
// Use blinkThing for the disappearing effect
101+
new blinkThing(this.game, tank, () => {
102+
this.game.mulle.stopAudio('89e001v0')
103+
this.game.time.events.remove(animationTimer)
104+
this.game.time.events.remove(buffaTimer)
105+
buffa.animations.stop()
106+
this.game.state.start('world')
107+
}, this)
108+
})
109+
})
110+
}
111+
112+
shutdown() {
113+
this.game.mulle.stopAudio('viola')
114+
super.shutdown()
115+
}
116+
}
117+
118+
export default ViolaState

0 commit comments

Comments
 (0)