This commit is contained in:
Bryce Covert
2017-09-25 11:28:29 -07:00
parent 95afad3756
commit 9a7c1078a2
14 changed files with 116 additions and 68 deletions

View File

@@ -14,6 +14,7 @@
[advent.screens.safe :as safe]
[advent.screens.fade :as fade]
[advent.steam :as steam]
[advent.iap :as iap]
[advent.pathfind])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
@@ -21,12 +22,13 @@
[com.badlogic.gdx Gdx Application]
[java.io FileOutputStream File PrintStream]))
(def has-purchased? (atom false))
(defonce am (asset-manager))
(set-asset-manager! am)
(defn create-game [advent]
(iap/use-pref)
(set-screen-wrapper! (fn [screen screen-fn]
(try (screen-fn)
(catch Exception e

View File

@@ -16,7 +16,9 @@
[play-clj.math :refer :all]
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all])
[play-clj.g2d :refer :all]
[advent.iap :as iap]
[advent.ios :as ios])
(:import [com.badlogic.gdx.graphics Color]
[com.badlogic.gdx Application Gdx]))
@@ -378,15 +380,10 @@
:label "Pit of destiny"
:cursor :look
:script (actions/get-script entities
(println "billing purchased before" @@(resolve 'advent.core/has-purchased?))
(when-not @@(resolve 'advent.core/has-purchased?)
(.triggerPurchase (Gdx/app))
(a/<!! @(resolve 'advent.android/purchase-chan)))
(println "billing purchased now:" @@(resolve 'advent.core/has-purchased?))
(when @@(resolve 'advent.core/has-purchased?)
(actions/walk-to entities :ego [154 41])
(actions/talk entities :ego "Wow! That's a long way down.")))
(actions/walk-to entities :ego [154 41])
(actions/talk entities :ego "Wow! That's a long way down."))
:scripts {:shovel (actions/get-script entities
(actions/walk-to entities :ego [154 41])
(actions/talk entities :ego "I guess I'm doomed to be a gravedigger.")

View File

@@ -8,7 +8,9 @@
[advent.tween :as tween]
[advent.steam :as steam]
[advent.utils :as utils]
[advent.iap :as iap]
[clojure.zip :as zip]
[clojure.core.async :as a]
[clojure.string :as str]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
@@ -634,28 +636,35 @@
(actions/walk-to entities :ego [257 90] :face :right :skip-type :end)
(actions/talk entities :ego (str "Anyone home?"))
(actions/play-animation entities :ego :reach)
(cond
(get-in @entities [:room :entities :wizard])
(actions/do-dialogue entities :wizard "What are you doing, boy?"
:wizard "I'm right here.")
(when-not @iap/has-purchased?
(when @iap/can-purchase?
(actions/talk entities :ego "Uh-oh! It looks like it's guarded by a warding spell!")
(actions/talk entities :ego "Looks like I need to buy an unwarding spell.")
(iap/start-purchase)
(a/<!! iap/purchase-chan)))
(when @iap/has-purchased?
(cond
(get-in @entities [:room :entities :wizard])
(actions/do-dialogue entities :wizard "What are you doing, boy?"
:wizard "I'm right here.")
(= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
(= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
:else
(do (actions/play-animation entities :door :open)
(actions/transition-background entities :inside-house [237 0] :between (fn [s e]
(if (= 1 (rand-int 5))
(assoc-in e [:room :entities :experiment] (get-in e [:room :experiment]))
e)))
(when (get-in @entities [:room :entities :experiment])
(actions/play-animation entities :experiment :experiment)
(actions/remove-entity entities :experiment))
(if (get-in @entities [:state :convinced-wizard?])
(do (actions/talk entities :wizard "Oh, hello there, boy.")
(utils/save @entities "autosave" "Autosave"))
(wizard-dialogue entities)))))
:else
(do (actions/play-animation entities :door :open)
(actions/transition-background entities :inside-house [237 0] :between (fn [s e]
(if (= 1 (rand-int 5))
(assoc-in e [:room :entities :experiment] (get-in e [:room :experiment]))
e)))
(when (get-in @entities [:room :entities :experiment])
(actions/play-animation entities :experiment :experiment)
(actions/remove-entity entities :experiment))
(if (get-in @entities [:state :convinced-wizard?])
(do (actions/talk entities :wizard "Oh, hello there, boy.")
(utils/save @entities "autosave" "Autosave"))
(wizard-dialogue entities))))))
:cursor :right}
:right-dir {:box [220 141 320 204]

View File

@@ -228,6 +228,17 @@
regular-version
mobile-version))
(defmacro platformify [ios-version android-version regular-version]
(println "Platforming: " (System/getProperty "platform"))
(cond (= "desktop" (System/getProperty "platform"))
regular-version
(= "android" (System/getProperty "platform"))
android-version
:else
ios-version))
(def screenshot-chan (chan))
(defn publish-screenshot-fn []