]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
item cooldown
authorClyne Sullivan <tullivan99@gmail.com>
Fri, 24 Mar 2017 13:24:04 +0000 (09:24 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Fri, 24 Mar 2017 13:24:04 +0000 (09:24 -0400)
config/items.xml
src/player.cpp
xml/!town.xml
xml/entities.xml

index 3601c18b35ecf5f162cd173ad343ffa56b54cbd4..7e3a1fbe6d2fe50c4323320539b7e993626bff1a 100644 (file)
@@ -17,8 +17,8 @@
 <!--##########-->
 
 <!-- WEAPONS -->
-<item name="Wood Sword"     type="Sword"    damage="3"  maxStackSize="1"  sound="assets/sounds/longSwing.wav"  sprite="assets/items/SWORD_WOOD.png" />
-<item name="Hunters Bow"    type="Bow"      damage="2"  maxStackSize="1"    sprite="assets/items/bow.png"/>
+<item name="Wood Sword"     type="Sword"    damage="3"  maxStackSize="1"  sound="assets/sounds/longSwing.wav"  sprite="assets/items/SWORD_WOOD.png" cooldown="250" />
+<item name="Hunters Bow"    type="Bow"      damage="2"  maxStackSize="1"    sprite="assets/items/bow.png" cooldown="600" />
 <item name="Arrow"    type="Arrow"    damage="1"  maxStackSize="99"   sprite="assets/items/arrow_crude.png"/>
 
 <!-- UTILITIES -->
index 1908af4119733c4023ba26cc4702e319f194050f..d9a4a9890638cda55f6000fd13fa44aee85fbaa5 100644 (file)
@@ -242,10 +242,10 @@ void PlayerSystem::receive(const UseItemEvent& uie)
                        }
                }
 
-               /*cool.store(false);
-               std::thread([&](void) {
-                       std::this_thread::sleep_for(std::chrono::milliseconds(uie.item->cooldown));
+               cool.store(false);
+               std::thread([&](unsigned int ms) {
+                       std::this_thread::sleep_for(std::chrono::milliseconds(ms));
                        cool.store(true);
-               }).detach();*/
+               }, uie.item->cooldown).detach();
        }
 }
index d256af9342fa4bf0d2cc4e626b1937113dad7737..c50932bdd758076276f32fc8ac8bcc0c776d2f32 100644 (file)
@@ -13,6 +13,7 @@
     <structure type="1" position="300.0,100.0"/>
     <structure inside="bobshouse.xml" type="1" position="10.0,100.0"/>
        <skirl />
+       <skirl />
 </World>
 
 <Dialog name="Bob">
index fb690860c50ce04bb6d4e621ce68ebd0a372f6d2..60fe149866428e8b38404d76ad09c72b568bad79 100644 (file)
@@ -62,7 +62,7 @@
                </frame>
        </Sprite>
        <Direction />
-       <Health value="200" />
+       <Health value="500" />
        <Solid />
        <Physics />
        <Name value="SKIRL" />