the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 60 lines 1.1 kB view raw
1#include "stdafx.h" 2#include "GuiParticle.h" 3#include "..\Minecraft.World\Random.h" 4 5Random *GuiParticle::random = new Random(); 6 7GuiParticle::GuiParticle(double x, double y, double xa, double ya) 8{ 9 // 4J - added initialisation block 10 removed = false; 11 life = 0; 12 a = 1; 13 oR = oG = oB = oA = 0; 14 15 this->xo = this->x = x; 16 this->yo = this->y = y; 17 this->xa = xa; 18 this->ya = ya; 19 20 int col = Color::HSBtoRGB(random->nextFloat(), 0.5f, 1); 21 r = ((col >> 16) & 0xff) / 255.0; 22 g = ((col >> 8) & 0xff) / 255.0; 23 b = ((col) & 0xff) / 255.0; 24 25 friction = 1.0 / (random->nextDouble() * 0.05 + 1.01); 26 27 lifeTime = (int) (10.0 / (random->nextDouble() * 2 + 0.1)); 28} 29 30void GuiParticle::tick(GuiParticles *guiParticles) 31{ 32 x += xa; 33 y += ya; 34 35 xa *= friction; 36 ya *= friction; 37 38 ya += 0.1; 39 if (++life > lifeTime) remove(); 40 a = 2 - (life / (double) lifeTime) * 2; 41 if (a > 1) a = 1; 42 a = a * a; 43 a *= 0.5; 44} 45 46void GuiParticle::preTick() 47{ 48 oR = r; 49 oG = g; 50 oB = b; 51 oA = a; 52 53 xo = x; 54 yo = y; 55} 56 57void GuiParticle::remove() 58{ 59 removed = true; 60}