diff --git a/code/difficultybutton.pas b/code/difficultybutton.pas new file mode 100644 index 0000000..cb6ce50 --- /dev/null +++ b/code/difficultybutton.pas @@ -0,0 +1,60 @@ +unit difficultybutton; + +{$mode delphi} + +interface + +uses +// System + Classes, +// Castle + CastleUIControls, CastleControls, CastleKeysMouse, castlescene, +// Own + gameoptions; + +type + TDifficultyButton = class(TCastleUserInterface) + published + ImageMarkerRight, ImageMarkerLeft: TCastleImageControl; + Tutorial, Easy, Normal, Hard, Insane: TCastleFog; + public + procedure Init(ADifficulty: NDifficulty; AButton: TCastleButton; AOnClick: TNotifyEvent); + procedure ButtonDifficultyMotion(const Sender: TCastleUserInterface; const Event: TInputMotion; var Handled: Boolean); + end; + +implementation + +uses +// System + SysUtils, +// Castle + CastleVectors, castleColors, +// Own + gameviewmain, Common; + +procedure TDifficultyButton.Init(ADifficulty: NDifficulty; AButton: TCastleButton; AOnClick: TNotifyEvent); +begin + AButton.Caption := DifficultyName(ADifficulty); + AButton.Tag := Ord(ADifficulty); + AButton.Pressed := AButton.Caption = DifficultyName(Difficulty()); + ImageMarkerLeft.Color := Vector4((AButton.Parent.FindComponent(AButton.Caption) as TCastleFog).Color, 1); + ImageMarkerRight.Color := ImageMarkerLeft.Color; + ImageMarkerRight.Exists := False; + ImageMarkerLeft.Exists := False; + AButton.OnMotion := ButtonDifficultyMotion; + AButton.OnClick := AOnClick; +end; + +procedure TDifficultyButton.ButtonDifficultyMotion(const Sender: TCastleUserInterface; const Event: TInputMotion; var Handled: Boolean); +var + LButton: TCastleUserInterface; +begin + for LButton in Sender.Parent do + if (LButton is TCastleButton) and (LButton.ControlsCount > 0) then + begin + LButton.Controls[0].Exists := Sender = LButton; + LButton.Controls[1].Exists := Sender = LButton; + end; +end; + +end. diff --git a/code/gameentities.pas b/code/gameentities.pas index e8e5dc5..8291776 100644 --- a/code/gameentities.pas +++ b/code/gameentities.pas @@ -107,7 +107,7 @@ TTower = class(TComponent) TMap = class(TComponent) private FTowers: TObjectList; - FDifficulty: NDifficulty; + FDifficulty: Integer; FLastTower, FLastStock, FHeroTowerIndex, FHeroStockIndex, FTargetTower, FTargetStock: Integer; FHero: THero; FHeroRoom: TRoom; @@ -141,10 +141,8 @@ TMap = class(TComponent) end; const - GameSeconds: array[NDifficulty] of Integer = (240, 360, 480, 600); + GameSeconds: array[NDifficulty] of Integer = (0, 240, 360, 480, 600); WeaponToOperation: array[NHeroWeapon] of string = ('', '+', '-', '*'); - WeaponFileNames: array[Succ(Low(NHeroWeapon))..High(NHeroWeapon)] of string = - ('weapon-shuriken.png', 'weapon-kunai.png', 'weapon-star.png'); implementation @@ -267,8 +265,8 @@ constructor TMap.Create(AOwner: TComponent); FMap := Self; FHero := THero.Create(nil); FTowers := TObjectList.Create(True); - FDifficulty := Difficulty(); - FLastTower := IIF(IsSchool(), 2, 3 + Ord(FDifficulty)); + FDifficulty := Ord(Difficulty()) - 1; + FLastTower := IIF(IsSchool(), 2, 3 + FDifficulty); FLastStock := Min(LastTower + 3, 8); FBoss := TBoss.Create(nil, LastTower, FLastStock); for T := 1 to LastTower do @@ -419,7 +417,7 @@ function TMap.Score(ATimeLeft: Integer): Integer; function TMap.BossCap(): Integer; begin - Result := FBoss.Level * 95 div 100 - (Random(5) + 5) * (Ord(Difficulty) + 1) + Result := FBoss.Level * 95 div 100 - (Random(5) + 5) * (FDifficulty + 1) end; constructor TEnemy.Create(AOwner: TComponent; ATower, AStock: Integer); @@ -447,7 +445,7 @@ constructor TWeaponLoot.Create(AOwner: TComponent; AWeapon: NHeroWeapon); begin inherited Create(AOwner); FWeapon := AWeapon; - FAssetId := 'castle-data:/resources/' + WeaponFileNames[AWeapon]; + FAssetId := Images.WeaponUrl(Ord(AWeapon)); end; function TWeaponLoot.GetVisual(): string; @@ -506,7 +504,7 @@ function TBoss.CalcLevel(ATower, AStock: Integer): Integer; begin if IsSchool() then Exit(SchoolBossLevel); - case Difficulty of + case Difficulty() of gdEasy: Result := 444; gdNormal: Result := 1000 + Random(5) * 100 + 40 + ValueOrZero(4); gdHard: Result := 2400 + Random(5) * 10 + ValueOrZero(4); diff --git a/code/gameoptions.pas b/code/gameoptions.pas index 392d2f6..e3c5e79 100644 --- a/code/gameoptions.pas +++ b/code/gameoptions.pas @@ -7,7 +7,7 @@ interface uses Classes, generics.collections; type - NDifficulty = (gdEasy, gdNormal, gdHard, gdInsane); + NDifficulty = (gdTutorial, gdEasy, gdNormal, gdHard, gdInsane); /// /// Current Difficulty, default is Easy diff --git a/code/gameviewdefeat.pas b/code/gameviewdefeat.pas index c71ec66..a8a204e 100644 --- a/code/gameviewdefeat.pas +++ b/code/gameviewdefeat.pas @@ -53,9 +53,11 @@ procedure TViewDefeat.ButtonMenuClick(Sender: TObject); procedure TViewDefeat.BackToMenu(); begin + { if IsSchool() then Container.View := ViewCredits else + } Container.View := ViewMain; end; @@ -67,7 +69,7 @@ function TViewDefeat.Press(const Event: TInputPressRelease): Boolean; if Event.IsKey(keyEscape) or Event.IsKey(keyEnter) or Event.IsKey(keyBackSpace) then begin BackToMenu(); - Exit(true); // key was handled + Exit(True); // key was handled end; end; diff --git a/code/gameviewformula.pas b/code/gameviewformula.pas index 8c9ae4e..fcf6dcf 100644 --- a/code/gameviewformula.pas +++ b/code/gameviewformula.pas @@ -52,7 +52,7 @@ implementation // Castle castlewindow, castlelog, castleglimages, castlecolors, // Own - gameviewgame, Common; + gameviewgame, Common, imagescomponent; constructor TViewFormula.Create(AOwner: TComponent); begin @@ -86,7 +86,7 @@ procedure TViewFormula.Resume; if AMarked then begin LButton.ImageScale := 0.2; - LButton.Image.Url := 'castle-data:/resources/' + WeaponFileNames[Weapon]; + LButton.Image.Url := Images.WeaponUrl(Ord(Weapon)); end else begin diff --git a/code/gameviewgame.pas b/code/gameviewgame.pas index dd44240..f842519 100644 --- a/code/gameviewgame.pas +++ b/code/gameviewgame.pas @@ -155,7 +155,7 @@ procedure TViewGame.Start(); begin LRoomComponent := TRoomComponent.Create(LGroupTower); LRoomUI := FactoryRoom.ComponentLoad(LGroupTower, LRoomComponent) as TCastleUserInterface; - LRoomComponent.InsertFront(LRoomUI); + LRoomComponent.InsertFront(LRoomUI); LRoomComponent.Name := 'Room' + LTowerIndex.ToString + '_' + LStockIndex.ToString; LGroupTower.InsertFront(LRoomComponent); LRoomComponent.ControlRoom.OnClick := ButtonRoomClick; @@ -304,7 +304,7 @@ procedure TViewGame.ButtonDefeatClick(Sender: TObject); procedure TViewGame.DefeatQuestionYes(Sender: TObject); begin if IsSchool() then - Container.View := ViewCredits + Container.View := ViewMain else Container.View := ViewDefeat; end; @@ -551,7 +551,7 @@ procedure TViewGame.TimerBloodTick(ASender: TObject); if Map.Hero.Dead then begin if IsSchool() then - DialogYesNo(Container, 'You lost, you''d better|follow the guide|try shool again ?', SchoolDefeatYes, SchoolDefeatNo) + DialogYesNo(Container, 'You lost, you''d better|follow the guide|try tutorial again ?', SchoolDefeatYes, SchoolDefeatNo) else Container.View := ViewDefeat end diff --git a/code/gameviewleaders.pas b/code/gameviewleaders.pas index dfe32af..11a07fc 100644 --- a/code/gameviewleaders.pas +++ b/code/gameviewleaders.pas @@ -48,7 +48,7 @@ implementation // Castle castlewindow, castlelog, // Own - gameoptions, castlerest, gameviewmain + gameoptions, castlerest, gameviewmain, difficultybutton ; constructor TViewLeaders.Create(AOwner: TComponent); @@ -69,22 +69,19 @@ procedure TViewLeaders.Start; var LDifficulty: NDifficulty; LButton: TCastleButton; - LCurrentDifficultyName: string; + LDifficultyButton: TDifficultyButton; begin inherited; ButtonMenu.OnClick := ButtonMenuClick; ButtonSync.OnClick := ButtonSyncClick; - LCurrentDifficultyName := DifficultyName(Difficulty()); - for LDifficulty in NDifficulty do + for LDifficulty := Succ(Low(NDifficulty)) to High(NDifficulty) do begin - LButton := FactoryButton.ComponentLoad(GroupDifficulty) as TCastleButton; - LButton.Caption := DifficultyName(LDifficulty); - LButton.Pressed := LButton.Caption = LCurrentDifficultyName; + LDifficultyButton := TDifficultyButton.Create(GroupDifficulty); + LButton := FactoryButton.ComponentLoad(GroupDifficulty, LDifficultyButton) as TCastleButton; + GroupDifficulty.InsertFront(LButton); + LDIfficultyButton.Init(LDifficulty, LButton, ButtonDifficultyClick); if LButton.Pressed then FCurrentDifficultyButton := LButton; - LButton.Tag := Ord(LDifficulty); - LButton.OnClick := ButtonDifficultyClick; - GroupDifficulty.InsertFront(LButton); end; GroupLeaders.ClearControls(); end; @@ -137,7 +134,6 @@ procedure TViewLeaders.ButtonDifficultyClick(Sender: TObject); procedure TViewLeaders.SwitchDifficulty(AButton: TCastleButton); var LButton: TCastleUserInterface; - LDifficulty: NDifficulty; LLeader: TLeader; LLabel: TCastleLabel; begin @@ -148,9 +144,8 @@ procedure TViewLeaders.SwitchDifficulty(AButton: TCastleButton); // populate the list of leaders for the selected difficulty. GroupLeaders.ClearControls(); - LDifficulty := NDifficulty(FCurrentDifficultyButton.Tag); for LLeader in FLeaders do - if LLeader.Difficulty = Ord(LDifficulty) then + if LLeader.Difficulty = Ord(NDifficulty(FCurrentDifficultyButton.Tag)) - 1 then begin LLabel := TCastleLabel.Create(GroupLeaders); LLabel.Caption := Format('%d %d %s', [LLeader.Number, LLeader.Score, LLeader.Name]); diff --git a/code/gameviewmain.pas b/code/gameviewmain.pas index fdcad44..24a63b9 100644 --- a/code/gameviewmain.pas +++ b/code/gameviewmain.pas @@ -16,14 +16,14 @@ interface CastleVectors, CastleUIControls, CastleControls, CastleKeysMouse, CastleComponentSerialize; type - { Main view, where most of the application logic takes place. } TViewMain = class(TCastleView) published ButtonStart, ButtonLeaders, ButtonExit, ButtonOptions, ButtonCredits: TCastleButton; - GroupOptions: TCastleUserInterface; + GroupOptions, GroupDifficulty: TCastleUserInterface; SliderMusic, SliderFullscreen, SliderUseTimer: TCastleIntegerSlider; FactoryButton: TCastleComponentFactory; - ImageRoomRoof2, ImageRoomRoof3: TCastleImageControl; + ImageRoomRoof2, ImageRoomRoof3, ImageOptions, ImageDifficulty: TCastleImageControl; + LabelFullscreen, LabelUseTimer: TCastleLabel; public constructor Create(AOwner: TComponent); override; procedure Start(); override; @@ -57,7 +57,7 @@ implementation castlewindow, castlemessages, castlesoundengine, CastleApplicationProperties, castlelog, // Own Common, gameviewgame, gameviewleaders, gameviewcredits, gameentities, gameoptions, - audiocomponent, gameviewdialog + audiocomponent, gameviewdialog, difficultybutton ; constructor TViewMain.Create(AOwner: TComponent); @@ -81,7 +81,7 @@ procedure TViewMain.Start(); var LDifficulty: NDifficulty; LButton: TCastleButton; - LCurrentDifficultyName: string; + LDifficultyButton: TDifficultyButton; begin inherited; SetLength(Buttons, 5); @@ -96,6 +96,8 @@ procedure TViewMain.Start(); for LButton in Buttons do LButton.OnMotion := ButtonMotion; + ImageOptions.OnMotion := ButtonMotion; + ImageDifficulty.OnMotion := ButtonMotion; ButtonExit.OnClick := ButtonExitClick; ButtonStart.OnClick := ButtonStartClick; @@ -108,19 +110,19 @@ procedure TViewMain.Start(); SliderFullscreen.Value := Ord(Fullscreen()); SliderFullscreen.OnChange := SliderFullscreenChange; + SliderFullscreenChange(SliderFullscreen); SliderUseTimer.Value := Ord(UseTimer()); SliderUseTimer.OnChange := SliderUseTimerChange; + SliderUseTimerChange(SliderUseTimer); - LCurrentDifficultyName := DifficultyName(Difficulty()); for LDifficulty in NDifficulty do begin - LButton := FactoryButton.ComponentLoad(GroupOptions) as TCastleButton; - LButton.Caption := DifficultyName(LDifficulty); - LButton.Pressed := LButton.Caption = LCurrentDifficultyName; - LButton.Tag := Ord(LDifficulty); - LButton.OnClick := ButtonDifficultyClick; - GroupOptions.InsertFront(LButton); + LDifficultyButton := TDifficultyButton.Create(GroupDifficulty); + LButton := FactoryButton.ComponentLoad(GroupDifficulty, LDifficultyButton) as TCastleButton; + WriteLnLog(LButton.ComponentCount.toString); + GroupDifficulty.InsertFront(LButton); + LDifficultyButton.Init(LDifficulty, LButton, ButtonDifficultyClick); end; end; @@ -140,12 +142,18 @@ procedure TViewMain.ButtonDifficultyClick(Sender: TObject); var LButton: TCastleUserInterface; begin - for LButton in GroupOptions do + for LButton in GroupDifficulty do if LButton is TCastleButton then begin TCastleButton(LButton).Pressed := LButton = Sender; if TCastleButton(LButton).Pressed then - SetDifficulty(NDifficulty(TCastleButton(LButton).Tag)); + begin + if LButton.Tag = Ord(gdTutorial) then + SetIsSchool(True) + else + SetDifficulty(NDifficulty(TCastleButton(LButton).Tag)); + Container.View := ViewGame; + end; end; end; @@ -159,19 +167,15 @@ procedure TViewMain.SliderMusicChange(Sender: TObject); end; procedure TViewMain.SliderFullscreenChange(Sender: TObject); -var - LFullscreenValue: Integer; begin - LFullscreenValue := (Sender as TCastleIntegerSlider).Value; - SetFullscreen(LFullscreenValue = 1); + SetFullscreen((Sender as TCastleIntegerSlider).Value = 1); + LabelFullScreen.Caption := 'FullScreen: ' + IIF(FullScreen(), 'On', 'Off'); end; procedure TViewMain.SliderUseTimerChange(Sender: TObject); -var - LUseTimerValue: Integer; begin - LUseTimerValue := (Sender as TCastleIntegerSlider).Value; - SetUseTimer(LUseTimerValue = 1); + SetUseTimer((Sender as TCastleIntegerSlider).Value = 1); + LabelUseTimer.Caption := 'Timer: ' + IIF(UseTimer(), 'On', 'Off'); end; procedure TViewMain.ButtonMotion(const Sender: TCastleUserInterface; const Event: TInputMotion; var Handled: Boolean); @@ -180,9 +184,18 @@ procedure TViewMain.ButtonMotion(const Sender: TCastleUserInterface; const Event begin for LButton in Buttons do LButton.ImageScale := 0; + if not (Sender is TCastleButton) then + begin + Handled := True; + Exit; + end; + + (Sender as TCastleButton).ImageScale := 0.08; (Sender as TCastleButton).ImageScale := 0.08; if Sender <> ButtonOptions then GroupOptions.Exists := False; + if Sender <> ButtonStart then + GroupDifficulty.Exists := False; end; procedure TViewMain.ButtonExitClick(Sender: TObject); @@ -192,7 +205,9 @@ procedure TViewMain.ButtonExitClick(Sender: TObject); procedure TViewMain.ButtonStartClick(Sender: TObject); begin - Container.View := ViewGame; + GroupDifficulty.Exists := not GroupDifficulty.Exists; + if not GroupDifficulty.Exists then + Container.View := ViewGame; end; procedure TViewMain.ButtonLeadersClick(Sender: TObject); @@ -207,13 +222,7 @@ procedure TViewMain.ButtonOptionsClick(Sender: TObject); procedure TViewMain.ButtonCreditsClick(Sender: TObject); begin - if not IsSchoolDone() then - begin - SetIsSchool(True); - Container.View := ViewGame; - end - else - Container.View := ViewCredits; + Container.View := ViewCredits; end; function TViewMain.Press(const Event: TInputPressRelease): Boolean; @@ -224,12 +233,12 @@ function TViewMain.Press(const Event: TInputPressRelease): Boolean; if Event.IsKey(keyEscape) then begin ButtonExit.DoClick(); - Exit(true); // key was handled + Exit(True); // key was handled end; if Event.IsKey(keyEnter) then begin ButtonStart.DoClick(); - Exit(true); // key was handled + Exit(True); // key was handled end; end; diff --git a/code/gameviewwin.pas b/code/gameviewwin.pas index 51fdd23..22c9a55 100644 --- a/code/gameviewwin.pas +++ b/code/gameviewwin.pas @@ -77,9 +77,11 @@ procedure TViewWin.ButtonMenuClick(Sender: TObject); procedure TViewWin.BackToMenu(); begin + { if IsSchool() then Container.View := ViewCredits else + } Container.View := ViewMain; end; @@ -106,7 +108,7 @@ function TViewWin.Press(const Event: TInputPressRelease): Boolean; if Event.IsKey(keyEscape) then begin BackToMenu(); - Exit(true); // key was handled + Exit(True); // key was handled end; end; diff --git a/code/imagescomponent.pas b/code/imagescomponent.pas index d26f657..8367dd8 100644 --- a/code/imagescomponent.pas +++ b/code/imagescomponent.pas @@ -8,7 +8,7 @@ interface // System Classes, Generics.Collections, // Castle - CastleTerrain; + Castlefonts; type @@ -20,11 +20,12 @@ TImagesComponent = class(TComponent) private class var FInstance: TImagesComponent; private - FImages: TArray; + FActorImages: TArray; + FWeaponImages: TArray; public constructor Create(AOwner: TComponent); override; - destructor Destroy(); override; function ImageUrl(APicture: NActorPicture): string; + function WeaponUrl(AWeaponIndex: Integer): string; end; function Images(): TImagesComponent; @@ -37,7 +38,7 @@ implementation // Castle CastleComponentSerialize, castlelog, // Own - Common, gameoptions + Common, gameoptions, gameentities ; function Images(): TImagesComponent; @@ -50,17 +51,25 @@ function Images(): TImagesComponent; constructor TImagesComponent.Create(AOwner: TComponent); procedure FetchImages(); var - LIndex: NActorPicture; - LImage: TCastleTerrainImage; + LIndex: Integer; + LImage: TCastleBitmapFont; begin - Setlength(FImages, Ord(High(NActorPicture)) + 1); - for LIndex := Low(NActorPicture) to High(NActorPicture) do + Setlength(FActorImages, Ord(High(NActorPicture)) + 1); + Setlength(FWeaponImages, Ord(High(NHeroWeapon)) + 1); + for LIndex := Ord(Low(NActorPicture)) to Ord(High(NActorPicture)) do begin - LImage := FindComponent(EnumName(TypeInfo(NActorPicture), Ord(LIndex))) as TCastleTerrainImage; + LImage := FindComponent(EnumName(TypeInfo(NActorPicture), Ord(LIndex))) as TCastleBitmapFont; if not Assigned(LImage) then Continue; - FImages[Ord(LIndex)] := LImage; + FActorImages[LIndex] := LImage; end; + for LIndex := Ord(Low(NHeroWeapon)) to Ord(High(NHeroWeapon)) do + begin + LImage := FindComponent('Weapon' + EnumName(TypeInfo(NHeroWeapon), Ord(LIndex))) as TCastleBitmapFont; + if not Assigned(LImage) then + Continue; + FWeaponImages[LIndex] := LImage; + end; end; begin inherited Create(AOwner); @@ -68,18 +77,14 @@ constructor TImagesComponent.Create(AOwner: TComponent); FetchImages(); end; -destructor TImagesComponent.Destroy(); -var - I: Integer; +function TImagesComponent.ImageUrl(APicture: NActorPicture): string; begin - for I := Low(FImages) to High(FImages) do - FreeAndNil(FImages[I]); - inherited Destroy(); + Result := FActorImages[Ord(APicture)].ImageUrl; end; -function TImagesComponent.ImageUrl(APicture: NActorPicture): string; +function TImagesComponent.WeaponUrl(AWeaponIndex: Integer): string; begin - Result := FImages[Ord(APicture)].Url; + Result := FWeaponImages[AWeaponIndex].ImageUrl; end; initialization diff --git a/code/models.pas b/code/models.pas index 1170dae..555b64f 100644 --- a/code/models.pas +++ b/code/models.pas @@ -79,7 +79,7 @@ constructor TSubmitLeader.Create(const AName: string; AScore: Integer; ADifficul Name := AName; Guid := UserGuid; Score := AScore; - Difficulty := Ord(ADifficulty); + Difficulty := Ord(ADifficulty) - 1; CalcHash(); end; diff --git a/code/roomcomponent.pas b/code/roomcomponent.pas index 9706d00..e8d25e3 100644 --- a/code/roomcomponent.pas +++ b/code/roomcomponent.pas @@ -17,7 +17,7 @@ TRoomComponent = class(TCastleUserInterface) published ControlRoom: TCastleButton; ImageRight, ImageLeft, ImageHeroWeapon: TCastleImageControl; - {LabelRight,} LabelLeft, LabelRight1, LabelRight2, LabelRight3: TCastleLabel; + LabelLeft, LabelRight1, LabelRight2, LabelRight3: TCastleLabel; public constructor Create(AOwner: TComponent); override; procedure SetEnemy(AEnemy: TActor); diff --git a/data/buttonDifficulty.castle-user-interface b/data/buttonDifficulty.castle-user-interface index f0f5f33..1a18ecf 100644 --- a/data/buttonDifficulty.castle-user-interface +++ b/data/buttonDifficulty.castle-user-interface @@ -30,11 +30,97 @@ }, "Name" : "ButtonDifficultyTemplate", "Toggle" : true, - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "Y" : -1.5800000000000000E+002 - }, - "VerticalAnchorParent" : "vpTop", - "VerticalAnchorSelf" : "vpTop", - "Width" : 3.0000000000000000E+002 + "Width" : 3.0000000000000000E+002, + "$NonVisualComponents" : [ + { + "$$ClassName" : "TCastleFog", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorRGBPersistent", + "Blue" : 0.0000000000000000E+000, + "Green" : 1.0000000000000000E+000, + "Red" : 0.0000000000000000E+000 + }, + "Name" : "Tutorial" + }, + { + "$$ClassName" : "TCastleFog", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorRGBPersistent", + "Blue" : 1.0000000000000000E+000, + "Green" : 1.0000000000000000E+000, + "Red" : 0.0000000000000000E+000 + }, + "Name" : "Easy" + }, + { + "$$ClassName" : "TCastleFog", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorRGBPersistent", + "Blue" : 1.0000000000000000E+000, + "Green" : 0.0000000000000000E+000, + "Red" : 0.0000000000000000E+000 + }, + "Name" : "Normal" + }, + { + "$$ClassName" : "TCastleFog", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorRGBPersistent", + "Blue" : 1.0000000000000000E+000, + "Green" : 0.0000000000000000E+000, + "Red" : 1.0000000000000000E+000 + }, + "Name" : "Hard" + }, + { + "$$ClassName" : "TCastleFog", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorRGBPersistent", + "Blue" : 0.0000000000000000E+000, + "Green" : 0.0000000000000000E+000, + "Red" : 1.0000000000000000E+000 + }, + "Name" : "Insane" + } + ], + "$Children" : [ + { + "$$ClassName" : "TCastleImageControl", + "Content" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/marker.png" + }, + "Height" : 2.0000000000000000E+001, + "Name" : "ImageMarkerLeft", + "Stretch" : true, + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : 8.0000000000000000E+000, + "Y" : 2.0000000000000000E+000 + }, + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "Width" : 2.0000000000000000E+001 + }, + { + "$$ClassName" : "TCastleImageControl", + "Content" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/marker.png" + }, + "Height" : 2.0000000000000000E+001, + "HorizontalAnchorParent" : "hpRight", + "HorizontalAnchorSelf" : "hpRight", + "Name" : "ImageMarkerRight", + "Stretch" : true, + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : -1.0000000000000000E+001, + "Y" : 2.0000000000000000E+000 + }, + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "Width" : 2.0000000000000000E+001 + } + ] } \ No newline at end of file diff --git a/data/gameviewcredits.castle-user-interface b/data/gameviewcredits.castle-user-interface index e9ba05d..cc40b67 100644 --- a/data/gameviewcredits.castle-user-interface +++ b/data/gameviewcredits.castle-user-interface @@ -73,6 +73,7 @@ "CustomBackgroundPressed" : { "$$ClassName" : "TCastleImagePersistent" }, + "Exists" : false, "FontSize" : 7.0000000000000000E+001, "Image" : { "$$ClassName" : "TCastleImagePersistent" @@ -423,7 +424,7 @@ "Spacing" : 7.0000000000000000E+001, "TranslationPersistent" : { "$$ClassName" : "TCastleVector2Persistent", - "X" : 1.0090648193359375E+003 + "X" : 1.1242473144531250E+003 }, "VerticalAnchorParent" : "vpMiddle", "VerticalAnchorSelf" : "vpMiddle", @@ -659,8 +660,8 @@ "Enter or Esc/Backspace - answer dialog", "Arrow keys or WASD - move in game", "1-4 or E (before fight) - select weapon", - "E (in Formula dialog) - pick weapon slot", - "Press Enter 4 times - fast battle restart" + "E (Formula dialog) - pick weapon target", + "Press Enter 5 times - fast battle restart" ], "VerticalAnchorParent" : "vpMiddle", "VerticalAnchorSelf" : "vpMiddle" diff --git a/data/gameviewgame.castle-user-interface b/data/gameviewgame.castle-user-interface index bfaf69e..06f2866 100644 --- a/data/gameviewgame.castle-user-interface +++ b/data/gameviewgame.castle-user-interface @@ -1075,7 +1075,7 @@ "try weapon to make him weaker", "click kunai on the weapon panel!", "It works as minus in formula view", - "Replace multiply sign with it!" + "Replace plus sign with it!" ] }, { diff --git a/data/gameviewmain.castle-user-interface b/data/gameviewmain.castle-user-interface index 9be9f77..9ff8184 100644 --- a/data/gameviewmain.castle-user-interface +++ b/data/gameviewmain.castle-user-interface @@ -321,112 +321,6 @@ } ] }, - { - "$$ClassName" : "TCastleVerticalGroup", - "Exists" : false, - "HorizontalAnchorParent" : "hpMiddle", - "HorizontalAnchorSelf" : "hpMiddle", - "Name" : "GroupOptions", - "Spacing" : 4.0000000000000000E+000, - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "X" : 3.5000000000000000E+002, - "Y" : -1.6000000000000000E+002 - }, - "VerticalAnchorParent" : "vpMiddle", - "VerticalAnchorSelf" : "vpMiddle", - "$Children" : [ - { - "$$ClassName" : "TCastleIntegerSlider", - "Background" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "Caption" : "FullScreen", - "Height" : 5.0000000000000000E+001, - "Max" : 1, - "Name" : "SliderFullScreen", - "Thumb" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "VerticalAnchorParent" : "vpTop", - "VerticalAnchorSelf" : "vpTop", - "Width" : 3.0000000000000000E+002 - }, - { - "$$ClassName" : "TCastleIntegerSlider", - "Background" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "Caption" : "GameTimer", - "Height" : 5.0000000000000000E+001, - "Max" : 1, - "Name" : "SliderUseTimer", - "Thumb" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "Y" : -5.4000000000000000E+001 - }, - "VerticalAnchorParent" : "vpTop", - "VerticalAnchorSelf" : "vpTop", - "Width" : 3.0000000000000000E+002 - }, - { - "$$ClassName" : "TCastleIntegerSlider", - "Background" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "Caption" : "Music", - "Height" : 5.0000000000000000E+001, - "Max" : 100, - "Name" : "SliderMusic", - "Thumb" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "Y" : -1.0800000000000000E+002 - }, - "VerticalAnchorParent" : "vpTop", - "VerticalAnchorSelf" : "vpTop", - "Width" : 3.0000000000000000E+002 - }, - { - "$$ClassName" : "TCastleButton", - "AutoSize" : false, - "Caption" : "Difficulty", - "CustomBackground" : true, - "CustomBackgroundDisabled" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "CustomBackgroundFocused" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "CustomBackgroundNormal" : { - "$$ClassName" : "TCastleImagePersistent", - "Url" : "castle-data:/resources/cell-old.png" - }, - "CustomBackgroundPressed" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "FontSize" : 5.0000000000000000E+001, - "Height" : 8.0000000000000000E+001, - "Image" : { - "$$ClassName" : "TCastleImagePersistent" - }, - "Name" : "ButtonDifficulty", - "TextAlignment" : "hpRight", - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "Y" : -1.6200000000000000E+002 - }, - "VerticalAnchorParent" : "vpTop", - "VerticalAnchorSelf" : "vpTop", - "Width" : 3.0000000000000000E+002 - } - ] - }, { "$$ClassName" : "TCastleImageControl", "Content" : { @@ -453,6 +347,212 @@ "Name" : "ImageSamuraiRight", "Stretch" : true, "WidthFraction" : 3.0000001192092896E-001 + }, + { + "$$ClassName" : "TCastleImageControl", + "AutoSizeToChildren" : true, + "Content" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/formulaback.png" + }, + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "ImageOptions", + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "$Children" : [ + { + "$$ClassName" : "TCastleVerticalGroup", + "Exists" : false, + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "GroupOptions", + "Padding" : 5.0000000000000000E+001, + "Spacing" : 4.0000000000000000E+000, + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "$Children" : [ + { + "$$ClassName" : "TCastleIntegerSlider", + "Background" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/cell-old.png" + }, + "Caption" : "FullScreen", + "DisplayValue" : false, + "Height" : 5.0000000000000000E+001, + "Max" : 1, + "Name" : "SliderFullScreen", + "Thumb" : { + "$$ClassName" : "TCastleImagePersistent", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorPersistent", + "Blue" : 4.8627451062202454E-001, + "Green" : 6.9019609689712524E-001, + "Red" : 8.3529412746429443E-001 + }, + "Url" : "castle-data:/resources/marker.png" + }, + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : 5.0000000000000000E+001, + "Y" : -5.0000000000000000E+001 + }, + "VerticalAnchorParent" : "vpTop", + "VerticalAnchorSelf" : "vpTop", + "Width" : 3.0000000000000000E+002, + "$Children" : [ + { + "$$ClassName" : "TCastleLabel", + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "LabelFullScreen", + "Text" : [ + "FullScreen" + ], + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle" + } + ] + }, + { + "$$ClassName" : "TCastleIntegerSlider", + "Background" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/cell-old.png" + }, + "Caption" : "GameTimer", + "DisplayValue" : false, + "Height" : 5.0000000000000000E+001, + "Max" : 1, + "Name" : "SliderUseTimer", + "Thumb" : { + "$$ClassName" : "TCastleImagePersistent", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorPersistent", + "Blue" : 4.8627451062202454E-001, + "Green" : 6.9019609689712524E-001, + "Red" : 8.3529412746429443E-001 + }, + "Url" : "castle-data:/resources/marker.png" + }, + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : 5.0000000000000000E+001, + "Y" : -1.0400000000000000E+002 + }, + "VerticalAnchorParent" : "vpTop", + "VerticalAnchorSelf" : "vpTop", + "Width" : 3.0000000000000000E+002, + "$Children" : [ + { + "$$ClassName" : "TCastleLabel", + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "LabelUseTimer", + "Text" : [ + "Timer" + ], + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle" + } + ] + }, + { + "$$ClassName" : "TCastleIntegerSlider", + "Background" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/cell-old.png" + }, + "Caption" : "Music", + "Height" : 5.0000000000000000E+001, + "Max" : 100, + "Name" : "SliderMusic", + "Thumb" : { + "$$ClassName" : "TCastleImagePersistent", + "ColorPersistent" : { + "$$ClassName" : "TCastleColorPersistent", + "Blue" : 4.8627451062202454E-001, + "Green" : 6.9019609689712524E-001, + "Red" : 8.3529412746429443E-001 + }, + "Url" : "castle-data:/resources/marker.png" + }, + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : 5.0000000000000000E+001, + "Y" : -1.5800000000000000E+002 + }, + "VerticalAnchorParent" : "vpTop", + "VerticalAnchorSelf" : "vpTop", + "Width" : 3.0000000000000000E+002 + } + ] + } + ] + }, + { + "$$ClassName" : "TCastleImageControl", + "AutoSizeToChildren" : true, + "Content" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/formulaback.png" + }, + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "ImageDifficulty", + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "$Children" : [ + { + "$$ClassName" : "TCastleVerticalGroup", + "Exists" : false, + "HorizontalAnchorParent" : "hpMiddle", + "HorizontalAnchorSelf" : "hpMiddle", + "Name" : "GroupDifficulty", + "Padding" : 5.0000000000000000E+001, + "Spacing" : 4.0000000000000000E+000, + "VerticalAnchorParent" : "vpMiddle", + "VerticalAnchorSelf" : "vpMiddle", + "$Children" : [ + { + "$$ClassName" : "TCastleButton", + "AutoSize" : false, + "Caption" : "Difficulty", + "CustomBackground" : true, + "CustomBackgroundDisabled" : { + "$$ClassName" : "TCastleImagePersistent" + }, + "CustomBackgroundFocused" : { + "$$ClassName" : "TCastleImagePersistent" + }, + "CustomBackgroundNormal" : { + "$$ClassName" : "TCastleImagePersistent", + "Url" : "castle-data:/resources/cell-old.png" + }, + "CustomBackgroundPressed" : { + "$$ClassName" : "TCastleImagePersistent" + }, + "Exists" : false, + "FontSize" : 5.0000000000000000E+001, + "Height" : 8.0000000000000000E+001, + "Image" : { + "$$ClassName" : "TCastleImagePersistent" + }, + "Name" : "ButtonDifficulty", + "TextAlignment" : "hpRight", + "TranslationPersistent" : { + "$$ClassName" : "TCastleVector2Persistent", + "X" : 5.0000000000000000E+001, + "Y" : -5.0000000000000000E+001 + }, + "VerticalAnchorParent" : "vpTop", + "VerticalAnchorSelf" : "vpTop", + "Width" : 3.0000000000000000E+002 + } + ] + } + ] } ] } \ No newline at end of file diff --git a/data/images.castle-component b/data/images.castle-component index 78f4ca9..d99cc7f 100644 --- a/data/images.castle-component +++ b/data/images.castle-component @@ -3,44 +3,59 @@ "Name" : "Component1", "$NonVisualComponents" : [ { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Hero", - "Url" : "castle-data:/resources/hero-samurai.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/hero-samurai.png", + "Name" : "Hero" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Boss", - "Url" : "castle-data:/resources/dragon.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/dragon.png", + "Name" : "Boss" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Enemy1", - "Url" : "castle-data:/resources/enemy-yokai.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/enemy-yokai.png", + "Name" : "Enemy1" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Enemy2", - "Url" : "castle-data:/resources/enemy-yurei.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/enemy-yurei.png", + "Name" : "Enemy2" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Enemy3", - "Url" : "castle-data:/resources/enemy-ninja.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/enemy-ninja.png", + "Name" : "Enemy3" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "Blood", - "Url" : "castle-data:/resources/blood_splat.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/blood_splat.png", + "Name" : "Blood" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "MiniBoss1", - "Url" : "castle-data:/resources/mini-boss-oni.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/mini-boss-oni.png", + "Name" : "MiniBoss1" }, { - "$$ClassName" : "TCastleTerrainImage", - "Name" : "MiniBoss2", - "Url" : "castle-data:/resources/mini-boss-shinigami.png" + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/mini-boss-shinigami.png", + "Name" : "MiniBoss2" + }, + { + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/weapon-shuriken.png", + "Name" : "WeaponPlus" + }, + { + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/weapon-kunai.png", + "Name" : "WeaponMinus" + }, + { + "$$ClassName" : "TCastleBitmapFont", + "ImageUrl" : "castle-data:/resources/weapon-star.png", + "Name" : "WeaponMultiply" } ] } \ No newline at end of file diff --git a/data/resources/marker.png b/data/resources/marker.png new file mode 100644 index 0000000..29a41fd Binary files /dev/null and b/data/resources/marker.png differ diff --git a/data/room.castle-user-interface b/data/room.castle-user-interface index 8e5ee29..c2a71ca 100644 --- a/data/room.castle-user-interface +++ b/data/room.castle-user-interface @@ -45,28 +45,6 @@ "VerticalAnchorSelf" : "vpTop", "Width" : 6.4000000000000000E+001 }, - { - "$$ClassName" : "TCastleLabel", - "Alignment" : "hpMiddle", - "BorderColorPersistent" : { - "$$ClassName" : "TCastleColorPersistent", - "Alpha" : 1.0000000000000000E+000 - }, - "Exists" : false, - "FontSize" : 3.5000000000000000E+001, - "HorizontalAnchorParent" : "hpMiddle", - "HorizontalAnchorSelf" : "hpMiddle", - "Html" : true, - "Name" : "LabelRight", - "Text" : [ - "R" - ], - "TranslationPersistent" : { - "$$ClassName" : "TCastleVector2Persistent", - "Y" : 5.0000000000000000E+000 - }, - "WidthFraction" : 1.0000000000000000E+000 - }, { "$$ClassName" : "TCastleHorizontalGroup", "HorizontalAnchorParent" : "hpMiddle", @@ -191,7 +169,7 @@ "Stretch" : true, "TranslationPersistent" : { "$$ClassName" : "TCastleVector2Persistent", - "Y" : -2.9999998092651367E+001 + "Y" : -3.0000000000000000E+001 }, "VerticalAnchorParent" : "vpTop", "VerticalAnchorSelf" : "vpTop",