Hello. What I am trying to do here, is avoid the game’s picking the same random notification when I click a button. For example, I have set variables for texts like this:
var p1 = "The best idea you've ever had! I'm training you so well! Do it. I'll give you a cookie after".localize()
Then, have an array with all the texts from notifications
var possibleTexts = [p1, p2, p3, n1, n2, n3, m1, m2, m3, m4]
So, every time I open the game, it picks a text, but clicking the button with this piece of code in its case
,
GameManager.company.notifications.push(notification);
I assume it pushes the notification sucessfully so the game enables it and you can see it.
(Notification:)
var header = "Magic 8 Ball".localize("heading")
notification = new Notification({
header: header,
text: possibleTexts[Math.floor(Math.random() * possibleTexts.length)],
image: imageSelector
});
In short words
Problem: Game picks the same text and not a random one each time.
What I’m trying to do: Pick a random text every time the button is pressed.
-Thank you in advance.