nutritious-gold-52850
02/15/2023, 11:36 PMcolossal-match-5265
02/15/2023, 11:36 PMnutritious-gold-52850
02/15/2023, 11:37 PMnutritious-gold-52850
02/15/2023, 11:37 PMnutritious-gold-52850
02/15/2023, 11:37 PMcolossal-match-5265
02/15/2023, 11:37 PMcolossal-match-5265
02/15/2023, 11:37 PMcolossal-match-5265
02/15/2023, 11:37 PMFlxTween.tween(menu, { x:menu.x, y:FlxG.height - menu.height}, 1, {type:ONESHOT, ease: FlxEase.backOut});
FlxTween.tween(menu, { x:menu.x, y:0}, 1, {type:ONESHOT, ease: FlxEase.cubeOut});colossal-match-5265
02/15/2023, 11:38 PM0. already.
If menu is open, you tween to 0
if menu is closed you tween to 0
thats why nothing movescolossal-match-5265
02/15/2023, 11:38 PMcolossal-match-5265
02/15/2023, 11:38 PMFlxG.height - menu.height is 0.colossal-match-5265
02/15/2023, 11:39 PMcolossal-match-5265
02/15/2023, 11:40 PMFlxG.height for offscreen below, or -FlxG.height for offscreen abovecolossal-match-5265
02/15/2023, 11:40 PMhallowed-holiday-15370
02/15/2023, 11:40 PMFlxSpriteGroup instead of making a FlxSpriteGroup and adding to it later?
IIRC, FlxSpriteGroup does something special with things that are added in the constructor (new) so that they work properlycolossal-match-5265
02/15/2023, 11:43 PMbreezy-account-94066
02/15/2023, 11:44 PMnutritious-gold-52850
02/15/2023, 11:44 PMnutritious-gold-52850
02/15/2023, 11:44 PMcolossal-match-5265
02/15/2023, 11:44 PMcolossal-match-5265
02/15/2023, 11:44 PMhallowed-holiday-15370
02/15/2023, 11:47 PMwitty-island-52596
02/16/2023, 12:18 AMhx
public function new (x = 50.0, y = 50.0)
{
super(0, 0);
add(a = new FlxSprite(0, 0, "assets/a.png"));
add(b = new FlxSprite(a.x + a.width, a.y, "assets/b.png"));
this.x = x;
this.y = y;
}
because with the following, (assuming the groups is placed in it's default position) b.y will end up at 100 (or a.y * 2), where above it will be at 50 or a.y
hx
public function new (x = 50.0, y = 50.0)
{
super(x, y);
add(a = new FlxSprite(0, 0, "assets/a.png"));
add(b = new FlxSprite(a.x + a.width, a.y, "assets/b.png"));
}green-jackal-11317
02/16/2023, 3:46 AMpoints copies a path array, then Math cos & sign rotate each point in points with degree degreeVariation, then +degreeOffset retains the path shape (otherwise the rotated shape would be a straight line) and mag retains each points length.
In my previous rotation attempt with example1 a single point was completely out of shape, then the other attempt with example2 an array of points retain their shape.
(1) https://discord.com/channels/162395145352904705/165234904815239168/1075384579482984499
(2) https://discord.com/channels/162395145352904705/165234904815239168/1075536637112619059witty-island-52596
02/16/2023, 3:52 AMwitty-island-52596
02/16/2023, 3:54 AMhx
package states;
import flixel.FlxSprite;
import flixel.group.FlxGroup;
import flixel.FlxCamera;
class OfffsetRotateTestState extends flixel.FlxState
{
inline static var ROT_SPEED = 200;
inline static var ROT_STAGGER = -30;
var sprites = new FlxTypedGroup<FlxSprite>();
override function create():Void
{
for (i in 0...4)
{
final sprite = new FlxSprite("assets/images/haxe.png");
sprite.screenCenter();
sprite.offset.setPolarDegrees(sprite.width * 1.25 * i, ROT_STAGGER * i);
sprites.add(sprite);
}
add(sprites);
}
override function update(elapsed:Float):Void
{
for (sprite in sprites)
{
sprite.offset.degrees += ROT_SPEED * elapsed;
}
}
}
because this seems to do all the things you're trying to do but much more directlywitty-island-52596
02/16/2023, 4:02 AMgreen-jackal-11317
02/16/2023, 5:09 AMgreen-jackal-11317
02/16/2023, 10:21 AMgreen-jackal-11317
02/16/2023, 10:34 AM