From 7c70ccb76a5e716c93effb80f1f0741fc3818c2c Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 21 Sep 2021 01:57:56 +0000 Subject: [PATCH] Gravity engine added. Fixed graphical position offset with Block clumps. --- Meteo_Engine.jar | Bin 7807 -> 8016 bytes src/sig/BlockClump.java | 2 +- src/sig/Board.java | 15 ++++++++++++++- src/sig/Meteo.java | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Meteo_Engine.jar b/Meteo_Engine.jar index 61b8f1b825cdccf300c2b0692e29e117c60c5d5b..6912362617aa03a9a79ed43cc536904c3ee34184 100644 GIT binary patch delta 5117 zcmZXYWmFVe*T?B@7`hocq@}yNLAv9DNJ--Q697vZywI(`S}3^|~Y z7Fh!I&*T{z8`$WXF10?{17D&LYNDyk38SKyVGeK5W$o8**l%tm|)+y5Tbr5c0wRe+ia9FHa4~< zo;_S|+|!h@!@%OOhPpZ@m?>wD+c~j6W8p&iV-+>EV%>2tpYiO)EZS4ZB$RKtG~=Cr zA0w^NxVVpWDTTjpe$msF6UjGPkY3<$i2)?^&LCLdqV~j5cq=A{a|U77sq8McY$>Yg z_F?9A5I8pfEN~E3NPaOp!s)a#MRjOBP~$c8vf|{;EI^U>#o>~MM~2KvrO@+=rDKt1 z4=2V54ewG-W0p$ZuTm@pJ5J?#tDL&NPjD0h%L*A#abk&$_y-Uik$9lvcwj{^Qz;eR zYN?LG3!1)B0FOfqR5g0k(REG2ta&?1EJ`VH1`LevHuOR_WtB2HL*qnuH#4n^D4j23 z6T`{h5RYmNvPCaG$=_{CU7BlPi+Uv6Fg6r2YE+_<7^KD1=gn$nZua5|CI8qcw|q7H z`I07L>LUXI`*i2`76N2{%NNd{?`pSr0V%0XdzU4cLMO8wBLgjl5H|TaBk^W!OH&5*^^j}M=vn#zMu!ODR96N0)raIJ(Dd9uZ z+Av(+*_6r0UA`9aqn#DemY$UlZVZ1L8MGdW@1;VQxrQ%9d>%LuznV%bLc}j9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VVS4e21?JC8k&T8pAJ*SLQ4bT57h`UBl2G#F!a37zzRpu6l4{lAR!Z{A5wK!8qW zB5G1&b0qu=Vlk@MP|9;A8|K&kI5Jrvm<>dP7 t^zV4`U#Cqvbj?3b|Gxi!)p{7wo17efZwKaLyJEzO7Utq1#0) { + blocks.yspd=Math.max(blocks.yspd+gravity,max_fall_spd); + blocks.y+=blocks.yspd; + } else { + //We have hit the bottom. + blocks.yspd=0; + blocks.y=0; + } + } + } public void drawBoard(Graphics g) { final int DRAW_STARTX = (int)(x - block_width*((double)width/2)); final int DRAW_STARTY = (int)(y + block_height*((double)height/2)); diff --git a/src/sig/Meteo.java b/src/sig/Meteo.java index 567c4a0..749a55d 100644 --- a/src/sig/Meteo.java +++ b/src/sig/Meteo.java @@ -15,11 +15,12 @@ public class Meteo { public static void runGameLoop() { FRAMECOUNT++; + b.run(); } public static void main(String[] args) { double[] val = {0,0,}; - b = new Board(SCREEN_WIDTH/2,SCREEN_HEIGHT/2,16,16,8,14,0.05,1,4,1,val); + b = new Board(SCREEN_WIDTH/2,SCREEN_HEIGHT/2,16,16,8,14,-0.065,1,4,-2,val); JFrame f = new JFrame("Meteo Engine"); Panel p = new Panel();