top of page
Website Created by fabr with logo by Logined Guest and inspired by Requiem and Psych News. Support Friday Night Funkin' on Newgrounds and Itch.io All characters and original Friday Night Funkin' game material belong to The Funkin Crew
bottom of page
Here is the relevant (Haxe) code from Funkin' is Magic
setSpr('pony1', addAnimPrefix( 4000, 235, "poners/lyra", 'pony', 1)); getSpr('pony1').scale.set(1.2,1.2); setSpr('pony2', addAnimPrefix( -6000, 245, "poners/bonbon", 'bonbon', 1.1)); getSpr('pony2').scale.set(1.4,1.4); getSpr('pony2').flipX = true; setSpr('pony3',addAnimPrefix( -8000, 255, "poners/minuette",'pony', 1.2)); getSpr('pony3').scale.set(1.6,1.6); getSpr('pony3').flipX = true; setSpr('pony4',addAnimPrefix( 14000, 245, "poners/vinyl",'pony', 1.2)); getSpr('pony4').scale.set(1.4,1.4); setSpr('pony5',addAnimPrefix( -10000, 235, "poners/octavia",'pony', 1.2)); getSpr('pony5').scale.set(1.2,1.2); getSpr('pony5').flipX = true; getSpr('pony1').velocity.x = -300; getSpr('pony2').velocity.x = 300; getSpr('pony3').velocity.x = 300; getSpr('pony4').velocity.x = -300; getSpr('pony5').velocity.x = 300;
Of particular note:
"getSpr" and "setSpr" are convenience functions that reference the characters from a map. This avoids creating a lot of individual variables.
Movement is done by setting the sprite's "velocity" value (here it's set for the X value). A sprite that has velocity set (make sure sprite.active = true) will move that many pixels per second.
The sprites are placed FAR OFFSCREEN, which delays their appearance on screen. For example, Octavia is placed 14,000 pixels off-screen and moves to the left (right is positive and left is negative) at a rate of 300 pixels per second. This means they will only enter the screen after about 45 seconds or so.
Hope this makes it clear how the background characters work here! Fun fact, the tank in the background of Week 7 works in a similar way.
not going to make a LUA, but I'll tell you that there is a tween thing in Psych Engine
doTweenX(tag:String, vars:String, value:Dynamic, duration:Float, ease:String)
EXAMPLE: doTweenX('imageX', 'image', 1000, 0.15, 'circleInOut');
it makes the X coordinate go to 0 to 1000 in 0.15 seconds
Could you be more specific?