-
-
Save Brin-o/399e330bf6199dd20f2ba2bcf8fa5159 to your computer and use it in GitHub Desktop.
Jiggly issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CREATE EVENT START - ta event se zgodi enkrat, ko se object spawna in | |
//tu se initializajo variabli, ki so potrebni za squish kodo | |
//Squish Set up | |
squish_x = 0; | |
squish_y = 1; | |
squish_xVel = 0; | |
squish_yVel = 0; | |
alarm[0] = irandom_range(0, 15); //to basically pomeni, da se "alarm" koda spori cez 0-15 framov (randomly zbran int) | |
//CREATE EVENT STOP | |
//ALARM 0 - ta koda se sprozi 0-15 (randomly) framov po create eventu | |
squish_x = random_range(1.25, 1.35); //randomly zbran float med 1.25 in 1.35 | |
//ALARM EVENT STOP | |
//DRAW EVENT - to se calla vsak frame po create eventu | |
var _sxprev = sign (1 - squish_x); | |
squish_x += squish_xVel; | |
squish_y = 1 / (squish_x); | |
squish_xVel *= 0.9; | |
if (_sxprev != sign(1-squish_x) && abs(squish_xVel) < 0.25) | |
{ | |
squish_xVel = 0; | |
squish_x = 1; | |
} | |
if (squish_x > 1) | |
squish_xVel -= 0.1; | |
else if (squish_x < 1) | |
squish_xVel += 0.1; | |
// to spodaj je koda, ki riše sprite. "squish_x/squish_y" določata x/y scale sprita | |
draw_sprite_ext(sprite_index, image_index, x, y , squish_x, squish_y, image_angle, image_blend, image_alpha); | |
//DRAW EVENT - KONEC | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment