Skip to content

Commit abf40d7

Browse files
committed
Init
1 parent 2ef3919 commit abf40d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4668
-19
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ to the [issue tracker][2] in our GitHub repository. Even better, you can submit
1919
a Pull Request with a fix. However, before doing so, please read the
2020
[submission guidelines][3].
2121

22-
[2]: https://github.com/Core-Team-META/CC-Template-Repository
22+
[2]: https://github.com/ManticoreGamesInc/CC-Player-Damage-Area
2323
[3]: #submission-guidelines
2424

2525
### Missing a feature?
@@ -71,7 +71,7 @@ go ahead.
7171
are no errors. This is a mandatory requirement for your PR to get accepted.
7272

7373
3. **Pull Request**: After making sure everything passes, commit your changes,
74-
push your branch to GitHub and send a PR to `Core-Team-META/CC-Template-Repository:main`.
74+
push your branch to GitHub and send a PR to `ManticoreGamesInc/CC-Player-Damage-Area:main`.
7575
If we suggest changes, make the required updates, rebase your branch and push the
7676
changes to your GitHub repository, which will automatically update your PR.
7777

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
MetaVersion: 1
2+
MarketplaceDetails {
3+
Id: "d653a6846eaa40e9b47fba0fb0bd4750"
4+
OwnerAccountId: "bd602d5201b04b3fbf7be10f59c8f974"
5+
OwnerName: "CoreAcademy"
6+
Version: "1.4.0"
7+
}
8+
AssetIdsOriginalToNew {
9+
key: 1111686434149961345
10+
value: 13072379430923150631
11+
}
12+
AssetIdsOriginalToNew {
13+
key: 2670272646095596115
14+
value: 8227855398560920946
15+
}
16+
AssetIdsOriginalToNew {
17+
key: 3027244679702011900
18+
value: 10947589097213846252
19+
}
20+
AssetIdsOriginalToNew {
21+
key: 4967487264352737949
22+
value: 2183201377267538967
23+
}
24+
AssetIdsOriginalToNew {
25+
key: 10019462501646249302
26+
value: 7748943637320866566
27+
}
28+
AssetIdsOriginalToNew {
29+
key: 14154976599502743816
30+
value: 16410659150543846122
31+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Assets {
2+
Id: 7748943637320866566
3+
Name: "Damage_Server"
4+
PlatformAssetType: 3
5+
TextAsset {
6+
CustomParameters {
7+
}
8+
}
9+
SerializationVersion: 121
10+
VirtualFolderPath: "Player Health"
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---@type Trigger
2+
local TRIGGER = script:GetCustomProperty("Trigger"):WaitForObject()
3+
4+
function Tick()
5+
local objects = TRIGGER:GetOverlappingObjects()
6+
7+
for index, object in ipairs(objects) do
8+
if(object:IsA("Player")) then
9+
object.hitPoints = math.max(0, object.hitPoints - 0.1)
10+
end
11+
end
12+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Assets {
2+
Id: 2183201377267538967
3+
Name: "Heal_Server"
4+
PlatformAssetType: 3
5+
TextAsset {
6+
CustomParameters {
7+
}
8+
}
9+
SerializationVersion: 121
10+
VirtualFolderPath: "Player Health"
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---@type Trigger
2+
local TRIGGER = script:GetCustomProperty("Trigger"):WaitForObject()
3+
4+
function Tick()
5+
local objects = TRIGGER:GetOverlappingObjects()
6+
7+
for index, object in ipairs(objects) do
8+
if(object:IsA("Player")) then
9+
object.hitPoints = math.min(object.maxHitPoints, object.hitPoints + 0.1)
10+
end
11+
end
12+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Assets {
2+
Id: 10947589097213846252
3+
Name: "Player_Health_Client"
4+
PlatformAssetType: 3
5+
TextAsset {
6+
CustomParameters {
7+
}
8+
}
9+
SerializationVersion: 121
10+
VirtualFolderPath: "Player Health"
11+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
local ROOT = script:GetCustomProperty("Root"):WaitForObject()
2+
local BAR = script:GetCustomProperty("Bar"):WaitForObject()
3+
local BACKGROUND = script:GetCustomProperty("Background"):WaitForObject()
4+
local BACKGROUND_COLOR = ROOT:GetCustomProperty("BackgroundColor")
5+
local BAR_COLOR = ROOT:GetCustomProperty("BarColor")
6+
local WIDTH = ROOT:GetCustomProperty("Width")
7+
local HEIGHT = ROOT:GetCustomProperty("Height")
8+
local OFFSET = ROOT:GetCustomProperty("Offset")
9+
local HEALTH_AMOUNT = script:GetCustomProperty("HealthAmount"):WaitForObject()
10+
local SHOW_TEXT = ROOT:GetCustomProperty("ShowText")
11+
12+
BACKGROUND:SetColor(BACKGROUND_COLOR)
13+
BACKGROUND.x = OFFSET.x
14+
BACKGROUND.y = OFFSET.y
15+
BACKGROUND.width = WIDTH
16+
BACKGROUND.height = HEIGHT
17+
18+
BAR:SetColor(BAR_COLOR)
19+
20+
local LOCAL_PLAYER = Game.GetLocalPlayer()
21+
22+
if(not SHOW_TEXT) then
23+
HEALTH_AMOUNT.visibility = Visibility.FORCE_OFF
24+
end
25+
26+
function Tick(dt)
27+
BAR.width = math.floor(LOCAL_PLAYER.hitPoints / LOCAL_PLAYER.maxHitPoints * WIDTH)
28+
29+
if(SHOW_TEXT) then
30+
HEALTH_AMOUNT.text = string.format("%0.f", LOCAL_PLAYER.hitPoints)
31+
end
32+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Assets {
2+
Id: 8227855398560920946
3+
Name: "README"
4+
PlatformAssetType: 3
5+
TextAsset {
6+
CustomParameters {
7+
}
8+
}
9+
SerializationVersion: 121
10+
VirtualFolderPath: "Player Health"
11+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--[[
2+
_____ _ _ _ _ _ _
3+
| __ \| | | | | | | | | | |
4+
| |__) | | __ _ _ _ ___ _ __ | |__| | ___ __ _| | |_| |__
5+
| ___/| |/ _` | | | |/ _ \ '__| | __ |/ _ \/ _` | | __| '_ \
6+
| | | | (_| | |_| | __/ | | | | | __/ (_| | | |_| | | |
7+
|_| |_|\__,_|\__, |\___|_| |_| |_|\___|\__,_|_|\__|_| |_|
8+
__/ |
9+
|___/
10+
------------------------------------------------------------------
11+
12+
The Player Health component will show a health bar and health number in the UI so the player can see how much
13+
health they have left. This is useful for games when health management is important. A player Knowing their
14+
health helps them be more cautious and strategic.
15+
16+
-----------------------------------------------------------------------------------------------------------------
17+
18+
==========
19+
How to use
20+
==========
21+
22+
Drag the Player Health template into the Hierarchy. The component comes with a heal and damage pad that can be
23+
used to test the health bar. These can be removed by deleting the group Heal / Damage Demo.
24+
25+
There are various properties on the root of the template that can be changed.
26+
27+
- BackgroundColor
28+
29+
The color of the bar background.
30+
31+
- BarColor
32+
33+
The color of the bar.
34+
35+
- Width
36+
37+
The width of the bar.
38+
39+
- Height
40+
41+
The height of the bar.
42+
43+
- Offset
44+
45+
The UI offset for X and Y.
46+
47+
- ShowText
48+
49+
If enabled, then the health amount will show in the bar.
50+
51+
--]]

0 commit comments

Comments
 (0)