Final icon structure, thanks tasadar2

Final icon structure, thanks tasadar2
This commit is contained in:
Ben987 2018-02-27 22:36:36 -05:00
parent 5f06cbca8c
commit a5d8d6c549
14 changed files with 40 additions and 64 deletions
C001_BeforeClass/Fight
C005_GymClass
GymFight
LoseFight
WinFight
C007_LunchBreak/JenniferTennis
C010_Revenge/SidneyJennifer
C101_KinbakuClub/Fight
C999_Common
Common.jsDrawing.js

View file

@ -1,6 +1,6 @@
// Chapter 5 - Before Class Fight Load
function C001_BeforeClass_Fight_Load() {
LoadFight("FightOutro", "Hard", -6, Icons.Fight.Punch);
LoadFight("FightOutro", "Hard", Icons.Fight.Punch);
}
// Chapter 5 - Before Class Fight Run

View file

@ -1,7 +1,7 @@
// Chapter 5 - Gym Fight Load
function C005_GymClass_GymFight_Load() {
if (C005_GymClass_Jennifer_PracticeMode) LoadFight("Jennifer", "Easy", -6, Icons.Fight.Punch);
else LoadFight("Jennifer", "Normal", -6, Icons.Fight.Punch);
if (C005_GymClass_Jennifer_PracticeMode) LoadFight("Jennifer", "Easy", Icons.Fight.Punch);
else LoadFight("Jennifer", "Normal", Icons.Fight.Punch);
}
// Chapter 5 - Gym Fight Run

View file

@ -1,7 +1,7 @@
// Chapter 5 - Lose Fight Load
function C005_GymClass_LoseFight_Load() {
if (C005_GymClass_Jennifer_EasyMode) LoadFight("Jennifer", "Easy", 0, Icons.Fight.Rope);
else LoadFight("Jennifer", "Normal", 0, Icons.Fight.Rope);
if (C005_GymClass_Jennifer_EasyMode) LoadFight("Jennifer", "Easy", Icons.Fight.Rope);
else LoadFight("Jennifer", "Normal", Icons.Fight.Rope);
}
// Chapter 5 - Lose Fight Run

View file

@ -1,7 +1,7 @@
// Chapter 5 - Win Fight Load
function C005_GymClass_WinFight_Load() {
if (C005_GymClass_Jennifer_EasyMode) LoadFight("Jennifer", "Normal", 0, Icons.Fight.Rope);
else LoadFight("Jennifer", "Hard", 0, Icons.Fight.Rope);
if (C005_GymClass_Jennifer_EasyMode) LoadFight("Jennifer", "Normal", Icons.Fight.Rope);
else LoadFight("Jennifer", "Hard", Icons.Fight.Rope);
}
// Chapter 5 - Win Fight Run

View file

@ -1,6 +1,6 @@
// Chapter 7 - Jennifer Tennis Fight Load
function C007_LunchBreak_JenniferTennis_Load() {
LoadFight("Jennifer", C007_LunchBreak_Jennifer_TennisDifficulty, 0, Icons.Fight.TennisBall);
LoadFight("Jennifer", C007_LunchBreak_Jennifer_TennisDifficulty, Icons.Fight.TennisBall);
}
// Chapter 7 - Jennifer Tennis Fight Run

View file

@ -420,7 +420,7 @@ function C010_Revenge_SidneyJennifer_RopePlayer() {
function C010_Revenge_SidneyJennifer_StartRace() {
CurrentTime = CurrentTime + 50000;
C010_Revenge_SidneyJennifer_IntroText = "";
RaceLoad("Player", DrawGetPlayerImageName(true), 10, "Normal", 2640, GetText("RaceGoal"), "KneeBound", "ElbowBound", "RunningTrack", "C010_Revenge_SidneyJennifer_EndRace");
RaceLoad("Player", DrawGetPlayerImageName(true), 10, "Normal", 2640, GetText("RaceGoal"), Icons.Race.KneeBound, Icons.Race.ElbowBound, "RunningTrack", "C010_Revenge_SidneyJennifer_EndRace");
}
// Chapter 10 - Sidney and Jennifer Revenge - When the race ends

View file

@ -1,6 +1,6 @@
// Chapter 101 - Erica Fight Load
function C101_KinbakuClub_Fight_Load() {
LoadFight("Erica", "Hard", -6, Icons.Fight.Punch);
LoadFight("Erica", "Hard", Icons.Fight.Punch);
}
// Chapter 101 - Erica Fight Run

View file

@ -9,7 +9,7 @@ var FightAnimTo = 1;
var FightAnimImage = 2;
var FightEnded = false;
var FightEndScreen = "";
var FightIconOffset = 0;
var FightIcon;
var FightDifficultyRatio = 1;
var FightDifficultyText = "";
var FightPerfect = true;
@ -18,8 +18,6 @@ var FightPerfect = true;
var FightMoveTypeKeyUpper = [65, 83, 75, 76];
var FightMoveTypeKeyLower = [97, 115, 107, 108];
var FightIcons = [];
// Generates a full fight sequence
function GenerateFightSequence(FightStartTime) {
@ -38,14 +36,8 @@ function GenerateFightSequence(FightStartTime) {
}
/**
* Load the fight animations and full sequence
* @param {*} EndScreen
* @param {*} DifficultyText
* @param {*} IconOffset
* @param {*} fightIcon Name of the fight icon to use. Or Array of each fight icon to use.
*/
function LoadFight(EndScreen, DifficultyText, IconOffset, fightIcon) {
// Load the fight animations and full sequence
function LoadFight(EndScreen, DifficultyText, IconImage) {
// Creates a brand new fight with the current screen animations
LeaveIcon = "";
@ -55,7 +47,7 @@ function LoadFight(EndScreen, DifficultyText, IconOffset, fightIcon) {
FightEnded = false;
FightAnim = null;
FightEndScreen = EndScreen;
FightIconOffset = IconOffset;
FightIcon = IconImage;
FightPerfect = true;
ReadCSV("FightAnim", CurrentChapter + "/" + CurrentScreen + "/Fight.csv");
LoadText();
@ -64,16 +56,9 @@ function LoadFight(EndScreen, DifficultyText, IconOffset, fightIcon) {
// 1 is the regular difficulty, the higher it goes, the harder it gets
FightDifficultyText = DifficultyText;
FightDifficultyRatio = 1;
if (FightDifficultyText == "Easy") FightDifficultyRatio = 0.6;
if (FightDifficultyText == "Easy") FightDifficultyRatio = 0.6667;
if (FightDifficultyText == "Hard") FightDifficultyRatio = 1.6667;
if (Array.isArray(fightIcon)) {
FightIcons = fightIcon;
} else {
for (var iconIndex = 0; iconIndex < 4; iconIndex++) {
FightIcons.push(fightIcon);
}
}
}
// Find the image file related to the current fight progress
@ -98,7 +83,7 @@ function DrawFightIcons(ctx) {
var currentIconTime = FightMoves[Seq][FightMoveTime];
var currentIconType = FightMoves[Seq][FightMoveType];
if ((currentIconTime <= FightTimer + 3000) && (currentIconTime >= FightTimer - 1000))
DrawImage(ctx, FightIcons[currentIconType], 811 + (currentIconType * 100) + FightIconOffset, 410 + Math.floor((FightTimer - currentIconTime) / 6));
DrawImage(ctx, FightIcon, 812 + (currentIconType * 100), 410 + Math.floor((FightTimer - currentIconTime) / 6));
// Remove the move from the sequence if it's past due
if (FightMoves[Seq][FightMoveTime] < FightTimer - 1000) {

Binary file not shown.

Before

(image error) Size: 7.2 KiB

After

(image error) Size: 6.9 KiB

Binary file not shown.

Before

(image error) Size: 10 KiB

After

(image error) Size: 10 KiB

Binary file not shown.

Before

(image error) Size: 8.7 KiB

After

(image error) Size: 8.6 KiB

View file

@ -98,9 +98,9 @@ function RaceDrawIcons(ctx) {
// Draw the move from 3 seconds before to 1 second after
if ((RaceMoves[Seq][RaceMoveTime] <= RaceTimer + 3000) && (RaceMoves[Seq][RaceMoveTime] >= RaceTimer - 1000)) {
if (RaceMoves[Seq][RaceMoveType] <= 3)
DrawImage(ctx, "C999_Common/Races/Icons/" + RaceIconLeft + ".png", 3 + (RaceMoves[Seq][RaceMoveType] * 75), 410 + Math.floor((RaceTimer - RaceMoves[Seq][RaceMoveTime]) / 6));
DrawImage(ctx, RaceIconLeft, 3 + (RaceMoves[Seq][RaceMoveType] * 75), 410 + Math.floor((RaceTimer - RaceMoves[Seq][RaceMoveTime]) / 6));
else
DrawImage(ctx, "C999_Common/Races/Icons/" + RaceIconRight + ".png", 603 + (RaceMoves[Seq][RaceMoveType] * 75), 410 + Math.floor((RaceTimer - RaceMoves[Seq][RaceMoveTime]) / 6));
DrawImage(ctx, RaceIconRight, 603 + (RaceMoves[Seq][RaceMoveType] * 75), 410 + Math.floor((RaceTimer - RaceMoves[Seq][RaceMoveTime]) / 6));
}
// Remove the move from the sequence if it's past due

View file

@ -271,14 +271,7 @@ function LeaveButtonClick() {
}
/**
* Creates a path from the supplied paths.
*
* Example:
* GetPath("foo") Returns "foo"
* GetPath("foo", "bar") Returns "foo/bar"
* @param {*} paths Param Array of paths.
*/
// Creates a path from the supplied paths parts
function GetPath(paths) {
var path = arguments[0];
for (var index = 1; index < arguments.length; index++) {

View file

@ -1,6 +1,22 @@
// A bank of all the chached images
var CacheImage = {};
// Icons bank and paths
var Icons = new function () {
this.Path = GetPath("Icons");
this.Fight = new function (parent) {
this.Path = GetPath("C999_Common", "Fights", "Icons");
this.Punch = GetIconPath(this.Path, "Punch");
this.Rope = GetIconPath(this.Path, "Rope");
this.TennisBall = GetIconPath(this.Path, "TennisBall");
}(this);
this.Race = new function (parent) {
this.Path = GetPath("C999_Common", "Races", "Icons");
this.ElbowBound = GetIconPath(this.Path, "ElbowBound");
this.KneeBound = GetIconPath(this.Path, "KneeBound");
}(this);
}();
// Returns the image file or build it from the source
function DrawGetImage(Source) {
@ -401,30 +417,12 @@ function DrawPlayerTransition(ctx) {
DrawImage(ctx, "Actors/PlayerTransition/Player0" + ImgRnd.toString() + ".png", 900, 0);
}
/**
* Returns a the path to a icon.
* iconName can be preceeded by additional paths.
* @param {*} iconName Name of the icon.
*/
function GetIconPath(iconName) {
// Returns a the path to a icon. IconName can be preceeded by additional paths.
function GetIconPath(IconName) {
return GetPath.apply(undefined, arguments) + ".png";
}
/**
* Returns a the path to an icon for the current screen.
* iconName can be preceeded by additional paths.
* @param {*} iconName Name of the icon.
*/
function GetIconScreenPath(iconName) {
// Returns a the path to an icon for the current screen. IconName can be preceeded by additional paths.
function GetIconScreenPath(IconName) {
return GetIconPath(GetPath.apply(undefined, [CurrentChapter, CurrentScreen].concat(Array.from(arguments))));
}
var Icons = new function () {
this.Path = GetPath("Icons");
this.Fight = new function (parent) {
this.Path = GetPath("C999_Common", "Fights", "Icons");
this.Punch = GetIconPath(this.Path, "Punch");
this.Rope = GetIconPath(this.Path, "Rope");
this.TennisBall = GetIconPath(this.Path, "TennisBall");
}(this);
}();
}