Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions toybox/Sandbox/1/scripts/scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,24 @@ function setCustomScene( %scene )
setSceneToWindow();
}

function SceneWindow::onExtentChange(%this)
//-----------------------------------------------------------------------------
// Match the camera's horizontal extent to the current window aspect ratio,
// keeping the camera height fixed. This fires on every live window resize, and
// is also re-applied after a toy loads/resets (see loadToy / RestartToyOverlay) --
// toys set a fixed camera size in their reset(), which bakes in a specific
// aspect, so without re-applying this the scene stretches when the toy is
// reloaded/restarted on a window that has since been resized to another shape.
//-----------------------------------------------------------------------------
function SceneWindow::updateCameraAspect(%this)
{
%extent = Canvas.extent;
%aspect = %extent.x / %extent.y;
%cam = SandboxWindow.getCameraSize();
%cam = %this.getCameraSize();
%cam.x = %cam.y * %aspect;
%this.setCameraSize(%cam);
}

function SceneWindow::onExtentChange(%this)
{
%this.updateCameraAspect();
}
4 changes: 4 additions & 0 deletions toybox/Sandbox/1/scripts/toolbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ function toggleToolbox(%make)
// Reset the toy.
if ( Sandbox.ActiveToy.ScopeSet.isMethod("reset") )
Sandbox.ActiveToy.ScopeSet.reset();

// reset() re-applies the toy's fixed-aspect camera size, so re-fit it to the
// current window (otherwise restarting on a resized window stretches the scene).
SandboxWindow.updateCameraAspect();
}

//-----------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion toybox/Sandbox/1/scripts/toys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ function loadToy( %moduleDefinition )
%moduleDefinition.ScopeSet.add( SandboxScene );

// Add toy scope-set as a listener.
SandboxWindow.addInputListener( %moduleDefinition.ScopeSet );
SandboxWindow.addInputListener( %moduleDefinition.ScopeSet );

// The toy just set its own (fixed-aspect) camera size during load. Re-fit it
// to the current window so the scene isn't stretched when the toy is loaded
// into a window that's been resized away from the toy's intended ratio.
SandboxWindow.updateCameraAspect();
}

//-----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<AnimationAsset
AssetName="Impact_ExplosionAnimation"
Image="@asset=TruckToy:Impact_ExplosionSprite"
AnimationFrames="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
AnimationTime="1"
AnimationCycle="0" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<AnimationAsset
AssetName="Projectile_FireballAnim"
Image="@asset=TruckToy:Projectile_FireballImage"
AnimationFrames="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
AnimationTime="1.06666994"
AnimationCycle="1" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<AnimationAsset
AssetName="Projectile_Meteor_StrikeAnimation"
Image="@asset=TruckToy:Projectile_Meteor_StrikeSprite"
AnimationFrames="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
AnimationTime="1" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ImageAsset
AssetName="Impact_ExplosionSprite"
ImageFile="Impact_Explosion.png"
CellCountX="4"
CellCountY="4"
CellWidth="128"
CellHeight="128" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ImageAsset
AssetName="Projectile_FireballImage"
ImageFile="Projectile_Fireball.png"
CellCountX="4"
CellCountY="4"
CellWidth="32"
CellHeight="32" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ImageAsset
AssetName="Projectile_Meteor_StrikeSprite"
ImageFile="Projectile_Meteor_Strike.png"
CellCountX="4"
CellCountY="4"
CellWidth="64"
CellHeight="96" />
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/background_0.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="background_0"
ImageFile="background_0.png" />
Binary file added toybox/TruckToy/1/assets/images/background_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/background_1.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="background_1"
ImageFile="background_1.png" />
Binary file added toybox/TruckToy/1/assets/images/background_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/background_2.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="background_2"
ImageFile="background_2.png" />
Binary file added toybox/TruckToy/1/assets/images/background_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/background_day.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/background_day.png
Binary file not shown.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/background_night.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/background_night.png
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file modified toybox/TruckToy/1/assets/images/brickPile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/brickWall_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/brickWall_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/brokenCementWall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/foregroundWall_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/foregroundWall_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Binary file not shown.
Binary file removed toybox/TruckToy/1/assets/images/industrial_01.png
Binary file not shown.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/industrial_02.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/industrial_02.png
Binary file not shown.

This file was deleted.

Binary file not shown.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/motorPile.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/motorPile.png
Binary file not shown.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/pileORocks.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/pileORocks.png
Binary file not shown.
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/planetFloor.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="planetFloor"
ImageFile="planetFloor.png" />
Binary file added toybox/TruckToy/1/assets/images/planetFloor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/plank_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/plank_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified toybox/TruckToy/1/assets/images/plank_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/tires.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/tires.png
Diff not rendered.
7 changes: 7 additions & 0 deletions toybox/TruckToy/1/assets/images/torqueBrick.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<ImageAsset
AssetName="torqueBrick"
ImageFile="torqueBrick.png"
CellWidth="64"
CellCountX="4"
CellHeight="32"
CellCountY="4" />
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/torqueBridge.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="torqueBridge"
ImageFile="torqueBridge.png" />
Binary file added toybox/TruckToy/1/assets/images/torqueBridge.png
Binary file modified toybox/TruckToy/1/assets/images/truckBody.png
3 changes: 3 additions & 0 deletions toybox/TruckToy/1/assets/images/truckTire.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ImageAsset
AssetName="truckTire"
ImageFile="truckTire.png" />
Binary file added toybox/TruckToy/1/assets/images/truckTire.png
Binary file modified toybox/TruckToy/1/assets/images/woodPile.png
Binary file modified toybox/TruckToy/1/assets/images/wreckedBuilding.png
Binary file modified toybox/TruckToy/1/assets/images/wreckedCar_01.png
Binary file modified toybox/TruckToy/1/assets/images/wreckedCar_02.png
Binary file modified toybox/TruckToy/1/assets/images/wreckedCar_03.png
3 changes: 0 additions & 3 deletions toybox/TruckToy/1/assets/images/wreckedCar_hood.asset.taml

This file was deleted.

Binary file removed toybox/TruckToy/1/assets/images/wreckedCar_hood.png
Diff not rendered.
79 changes: 79 additions & 0 deletions toybox/TruckToy/1/assets/particles/bonfire.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<ParticleAsset
AssetName="bonfire">
<ParticleAssetEmitter
EmitterName="smoke"
EmitterType="line"
EmitterSize="0.5 0"
EmitterOffset="0 1"
FixedForceAngle="90"
OldestInFront="1"
Image="@asset=ToyAssets:Particles4"
Frame="0">
<ParticleAssetEmitter.Fields>
<Quantity
Keys="0 10" />
<EmissionAngle
Keys="0 90" />
<EmissionArc
Keys="0 0" />
<LifetimeVariation
Keys="0 1" />
<Speed
Keys="0 0.3" />
<SpeedVariation
Keys="0 0.1" />
<FixedForce
Keys="0 0" />
<FixedForceVariation
Keys="0 0" />
<SizeXLife>
<Key Time="0" Value="0"/>
<Key Time="0.2" Value="1"/>
<Key Time="0.5" Value="1"/>
<Key Time="0.9" Value="1"/>
<Key Time="1" Value="0"/>
</SizeXLife>
<SizeXVariation
Keys="0 0.3" />
<SpinVariation
Keys="0 360" />
<AlphaChannel
Keys="0 0 0.2 0.15 1 0" />
</ParticleAssetEmitter.Fields>
</ParticleAssetEmitter>
<ParticleAssetEmitter
EmitterName="flames"
EmitterType="LINE"
EmitterSize="1 0"
FixedForceAngle="90"
IntenseParticles="1"
OldestInFront="1"
Animation="@asset=TruckToy:Projectile_Meteor_StrikeAnimation">
<ParticleAssetEmitter.Fields>
<Quantity
Keys="0 20" />
<EmissionArc
Keys="0 30" />
<Lifetime
Keys="0 1" />
<Speed
Keys="0 0.1" />
<SizeXVariation
Keys="0 0.2" />
<FixedForce
Keys="0 30" />
<SizeXLife
Keys="0 0 0.1 0.5" />
<RandomMotion
Keys="0 10" />
<FixedForceVariation
Keys="0 10" />
<SpinVariation
Keys="0 360" />
<AlphaChannel
Keys="0 0 0.1 1 0.8 1 1 0" />
<EmissionAngle
Keys="0 90" />
</ParticleAssetEmitter.Fields>
</ParticleAssetEmitter>
</ParticleAsset>
69 changes: 69 additions & 0 deletions toybox/TruckToy/1/assets/particles/explosion.asset.taml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<ParticleAsset
AssetName="explosion"
Lifetime="1"
LifeMode="STOP">
<ParticleAssetEmitter
EmitterName="debris"
EmitterType="BOX"
EmitterAngle="90"
EmitterSize="2 1"
AttachPositionToEmitter="1"
AttachRotationToEmitter="1"
FixedForceAngle="-90"
OldestInFront="1"
Image="@asset=ToyAssets:Asteroids"
RandomImageFrame="1">
<ParticleAssetEmitter.Fields>
<Quantity
Keys="0 250 0.1 150 0.11 0" />
<LifetimeVariation
Keys="0 1" />
<EmissionArc
Keys="0 90" />
<Speed
Keys="0 1.8" />
<SizeXVariation
Keys="0 2.1" />
<FixedForce
Keys="0 8" />
<SizeXLife
Keys="0 0 0.1 0.1" />
<RandomMotion
Keys="0 10" />
<FixedForceVariation
Keys="0 2" />
<SpinVariation
Keys="0 360" />
<SpeedVariation
Keys="0 0.3" />
<AlphaChannel
Keys="0 0 0.1 1 0.8 1 1 0" />
<EmissionAngle
Keys="0 90" />
</ParticleAssetEmitter.Fields>
</ParticleAssetEmitter>
<ParticleAssetEmitter
EmitterName="flames"
EmitterType="LINE"
EmitterSize="1 0"
AttachPositionToEmitter="1"
AttachRotationToEmitter="1"
IntenseParticles="1"
OldestInFront="1"
Animation="@asset=TruckToy:Impact_ExplosionAnimation">
<ParticleAssetEmitter.Fields>
<Quantity
Keys="0 20 0.1 20 0.11 0" />
<Lifetime
Keys="0 1" />
<Speed
Keys="0 0" />
<SizeXVariation
Keys="0 2" />
<SizeXLife
Keys="0 0 0.1 3" />
<AlphaChannel
Keys="0 0 0.1 1 0.8 1 1 0" />
</ParticleAssetEmitter.Fields>
</ParticleAssetEmitter>
</ParticleAsset>
Loading
Loading