mirror of
https://github.com/thepaperpilot/The-Modding-Tree.git
synced 2025-02-07 18:41:36 +00:00
Added makeShinies
This commit is contained in:
parent
ac9f561338
commit
f29d79f0f4
7 changed files with 76 additions and 30 deletions
|
@ -1,5 +1,12 @@
|
||||||
# The Modding Tree changelog:
|
# The Modding Tree changelog:
|
||||||
|
|
||||||
|
# v2.5.8 - 5/15/21
|
||||||
|
- Added makeShinies, which creates a stationary particle in a random spot.
|
||||||
|
- Bars will visually update more quickly.
|
||||||
|
- Fixed a major particle-related issue.
|
||||||
|
- Fixed autoUpgrade.
|
||||||
|
- Fixed a minor visal issue with tree nodes.
|
||||||
|
|
||||||
# v2.5.7 - 5/15/21
|
# v2.5.7 - 5/15/21
|
||||||
- Added a particle system! Not only can it be used for visual effects, but particles can interact with the mouse. They could be used to create golden cookies or collectables, for example.
|
- Added a particle system! Not only can it be used for visual effects, but particles can interact with the mouse. They could be used to create golden cookies or collectables, for example.
|
||||||
- Added marked feature to buyables, clickables, and challenges. By default, stars multi-completion challenges when maxed.
|
- Added marked feature to buyables, clickables, and challenges. By default, stars multi-completion challenges when maxed.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Particles are free-floating elements that can move and have many different behaviors. They can also interact with the mouse.
|
Particles are free-floating elements that can move and have many different behaviors. They can also interact with the mouse.
|
||||||
|
|
||||||
To make particles, use `makeParticles(particle, amount)`. `particle` is a particle-defining object, with features as explained below. There are also a few other useful things listed at the end.
|
To make particles, use `makeParticles(particle, amount)`. `particle` is a particle-defining object, with features as explained below. There is also `makeShinies`, which uses different defaults and creates stationary particles at a random location. There are also a few other useful things listed at the end.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ let modInfo = {
|
||||||
|
|
||||||
// Set your version in num and name
|
// Set your version in num and name
|
||||||
let VERSION = {
|
let VERSION = {
|
||||||
num: "2.5.7",
|
num: "2.5.8",
|
||||||
name: "Dreams Really Do Come True",
|
name: "Dreams Really Do Come True",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ var scrolled = false;
|
||||||
|
|
||||||
// Don't change this
|
// Don't change this
|
||||||
const TMT_VERSION = {
|
const TMT_VERSION = {
|
||||||
tmtNum: "2.5.7",
|
tmtNum: "2.5.8",
|
||||||
tmtName: "Dreams Really Do Come True"
|
tmtName: "Dreams Really Do Come True"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ function gameLoop(diff) {
|
||||||
let layer = TREE_LAYERS[x][item]
|
let layer = TREE_LAYERS[x][item]
|
||||||
if (tmp[layer].autoPrestige && tmp[layer].canReset) doReset(layer);
|
if (tmp[layer].autoPrestige && tmp[layer].canReset) doReset(layer);
|
||||||
if (layers[layer].automate) layers[layer].automate();
|
if (layers[layer].automate) layers[layer].automate();
|
||||||
if (layers[layer].autoUpgrade) autobuyUpgrades(layer)
|
if (tmp[layer].autoUpgrade) autobuyUpgrades(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,12 @@ function achievementStyle(layer, id){
|
||||||
|
|
||||||
function updateWidth() {
|
function updateWidth() {
|
||||||
var screenWidth = window.innerWidth
|
var screenWidth = window.innerWidth
|
||||||
|
|
||||||
var splitScreen = screenWidth >= 1024
|
var splitScreen = screenWidth >= 1024
|
||||||
if (player.forceOneTab) splitScreen = false
|
if (player.forceOneTab) splitScreen = false
|
||||||
tmp.other.screenWidth = screenWidth
|
tmp.other.screenWidth = screenWidth
|
||||||
|
tmp.other.screenHeight = window.innerHeight
|
||||||
|
|
||||||
tmp.other.splitScreen = splitScreen
|
tmp.other.splitScreen = splitScreen
|
||||||
tmp.other.lastPoints = player.points
|
tmp.other.lastPoints = player.points
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ var particleID = 0;
|
||||||
var mouseX = 0;
|
var mouseX = 0;
|
||||||
var mouseY = 0;
|
var mouseY = 0;
|
||||||
|
|
||||||
function makeParticles(data, amount=1) {
|
function makeParticles(data, amount=1, type = "normal") {
|
||||||
for (let x = 0; x < amount; x++) {
|
for (let x = 0; x < amount; x++) {
|
||||||
let particle = getNewParticle()
|
let particle = newParticles[type]()
|
||||||
for (thing in data) {
|
for (thing in data) {
|
||||||
|
|
||||||
switch(thing) {
|
switch(thing) {
|
||||||
|
@ -25,8 +25,10 @@ function makeParticles(data, amount=1) {
|
||||||
}
|
}
|
||||||
particle.dir = particle.dir + (particle.spread * (x- amount/2 + 0.5))
|
particle.dir = particle.dir + (particle.spread * (x- amount/2 + 0.5))
|
||||||
|
|
||||||
particle.x += particle.offset * sin(particle.dir)
|
if(particle.offset) {
|
||||||
particle.y += particle.offset * cos(particle.dir) * -1
|
particle.x += particle.offset * sin(particle.dir)
|
||||||
|
particle.y += particle.offset * cos(particle.dir) * -1
|
||||||
|
}
|
||||||
|
|
||||||
particle.xVel = particle.speed * sin(particle.dir)
|
particle.xVel = particle.speed * sin(particle.dir)
|
||||||
particle.yVel = particle.speed * cos(particle.dir) * -1
|
particle.yVel = particle.speed * cos(particle.dir) * -1
|
||||||
|
@ -36,6 +38,11 @@ function makeParticles(data, amount=1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Makes a particle at a random location that stays still until it despawns
|
||||||
|
function makeShinies(data, amount=1) {
|
||||||
|
makeParticles(data, amount, "shiny")
|
||||||
|
}
|
||||||
|
|
||||||
function sin(x) {
|
function sin(x) {
|
||||||
return Math.sin(x*Math.PI/180)
|
return Math.sin(x*Math.PI/180)
|
||||||
}
|
}
|
||||||
|
@ -64,30 +71,57 @@ function updateParticles(diff) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewParticle() {
|
const newParticles = {
|
||||||
particleID++
|
normal() {
|
||||||
return {
|
particleID++
|
||||||
time: 3,
|
return {
|
||||||
id: particleID,
|
time: 3,
|
||||||
x: mouseX,
|
id: particleID,
|
||||||
y: mouseY,
|
x: mouseX,
|
||||||
width: 35,
|
y: mouseY,
|
||||||
height: 35,
|
width: 35,
|
||||||
image: "resources/genericParticle.png",
|
height: 35,
|
||||||
angle: 0,
|
image: "resources/genericParticle.png",
|
||||||
spread: 30,
|
angle: 0,
|
||||||
offset: 10,
|
spread: 30,
|
||||||
speed: 15,
|
offset: 10,
|
||||||
xVel: 0,
|
speed: 15,
|
||||||
yVel: 0,
|
xVel: 0,
|
||||||
rotation: 0,
|
yVel: 0,
|
||||||
gravity: 0,
|
rotation: 0,
|
||||||
fadeOutTime: 1,
|
gravity: 0,
|
||||||
fadeInTimer: 0,
|
fadeOutTime: 1,
|
||||||
fadeIn: 0,
|
fadeInTimer: 0,
|
||||||
}
|
fadeInTime: 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
shiny() {
|
||||||
|
particleID++
|
||||||
|
return {
|
||||||
|
time: 10,
|
||||||
|
id: particleID,
|
||||||
|
x: Math.random() * (tmp.other.screenWidth - 100) + 50,
|
||||||
|
y: Math.random() * (tmp.other.screenHeight - 100) + 50,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
image: "resources/genericParticle.png",
|
||||||
|
angle: 0,
|
||||||
|
spread: 0,
|
||||||
|
offset: 0,
|
||||||
|
speed: 0,
|
||||||
|
xVel: 0,
|
||||||
|
yVel: 0,
|
||||||
|
rotation: 0,
|
||||||
|
gravity: 0,
|
||||||
|
fadeOutTime: 1,
|
||||||
|
fadeInTimer: 0,
|
||||||
|
fadeInTime: 0.5,
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateMouse(event) {
|
function updateMouse(event) {
|
||||||
mouseX = event.clientX
|
mouseX = event.clientX
|
||||||
mouseY = event.clientY
|
mouseY = event.clientY
|
||||||
|
|
|
@ -45,6 +45,8 @@ function setupTemp() {
|
||||||
tmp.other = {
|
tmp.other = {
|
||||||
lastPoints: player.points || decimalZero,
|
lastPoints: player.points || decimalZero,
|
||||||
oomps: decimalZero,
|
oomps: decimalZero,
|
||||||
|
screenWidth: 0,
|
||||||
|
screenHeight: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWidth()
|
updateWidth()
|
||||||
|
|
Loading…
Add table
Reference in a new issue