1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-22 00:21:32 +00:00

Added makeShinies

This commit is contained in:
Harley White 2021-05-17 21:51:36 -04:00
parent ac9f561338
commit f29d79f0f4
7 changed files with 76 additions and 30 deletions

View file

@ -1,5 +1,12 @@
# 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
- 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.

View file

@ -2,7 +2,7 @@
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

View file

@ -11,7 +11,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
num: "2.5.7",
num: "2.5.8",
name: "Dreams Really Do Come True",
}

View file

@ -5,7 +5,7 @@ var scrolled = false;
// Don't change this
const TMT_VERSION = {
tmtNum: "2.5.7",
tmtNum: "2.5.8",
tmtName: "Dreams Really Do Come True"
}
@ -370,7 +370,7 @@ function gameLoop(diff) {
let layer = TREE_LAYERS[x][item]
if (tmp[layer].autoPrestige && tmp[layer].canReset) doReset(layer);
if (layers[layer].automate) layers[layer].automate();
if (layers[layer].autoUpgrade) autobuyUpgrades(layer)
if (tmp[layer].autoUpgrade) autobuyUpgrades(layer)
}
}

View file

@ -52,9 +52,12 @@ function achievementStyle(layer, id){
function updateWidth() {
var screenWidth = window.innerWidth
var splitScreen = screenWidth >= 1024
if (player.forceOneTab) splitScreen = false
tmp.other.screenWidth = screenWidth
tmp.other.screenHeight = window.innerHeight
tmp.other.splitScreen = splitScreen
tmp.other.lastPoints = player.points
}

View file

@ -3,9 +3,9 @@ var particleID = 0;
var mouseX = 0;
var mouseY = 0;
function makeParticles(data, amount=1) {
function makeParticles(data, amount=1, type = "normal") {
for (let x = 0; x < amount; x++) {
let particle = getNewParticle()
let particle = newParticles[type]()
for (thing in data) {
switch(thing) {
@ -25,8 +25,10 @@ function makeParticles(data, amount=1) {
}
particle.dir = particle.dir + (particle.spread * (x- amount/2 + 0.5))
if(particle.offset) {
particle.x += particle.offset * sin(particle.dir)
particle.y += particle.offset * cos(particle.dir) * -1
}
particle.xVel = particle.speed * sin(particle.dir)
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) {
return Math.sin(x*Math.PI/180)
}
@ -64,7 +71,8 @@ function updateParticles(diff) {
}
}
function getNewParticle() {
const newParticles = {
normal() {
particleID++
return {
time: 3,
@ -84,10 +92,36 @@ function getNewParticle() {
gravity: 0,
fadeOutTime: 1,
fadeInTimer: 0,
fadeIn: 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) {
mouseX = event.clientX
mouseY = event.clientY

View file

@ -45,6 +45,8 @@ function setupTemp() {
tmp.other = {
lastPoints: player.points || decimalZero,
oomps: decimalZero,
screenWidth: 0,
screenHeight: 0,
}
updateWidth()