able-printer-41379
02/15/2023, 6:36 PMable-printer-41379
02/15/2023, 6:38 PMwitty-island-52596
02/15/2023, 6:52 PMgreen-jackal-11317
02/15/2023, 9:58 PMmag=Magnitude(points[0].x, points[0].y);//scaler
degreeOffset=PointToAngle(points[0].x, points[0].y);//degree offset
sprite1.offset.set(mag*Math.cos(degreeOffset*(Math.PI/180)), mag*Math.sin(degreeOffset*(Math.PI/180)));green-jackal-11317
02/15/2023, 10:07 PMwitty-island-52596
02/15/2023, 10:42 PMwitty-island-52596
02/15/2023, 10:44 PMwitty-island-52596
02/15/2023, 10:45 PMwitty-island-52596
02/15/2023, 10:51 PMhx
mag=Magnitude(points[0].x, points[0].y);//scaler
degreeOffset=PointToAngle(points[0].x, points[0].y);//degree offset
sprite1.offset.set(mag*Math.cos(degreeOffset*(Math.PI/180)), mag*Math.sin(degreeOffset*(Math.PI/180)));
I'm really confused by what you're trying to do herewitty-island-52596
02/15/2023, 10:53 PMhx
mag=Magnitude(points[0].x, points[0].y);//scaler
degreeOffset=PointToAngle(points[0].x, points[0].y);//degree offset
can just be:
hx
mag = points[0].length;
degreeOffset = points[0].degrees;witty-island-52596
02/15/2023, 10:54 PMhx
sprite1.offset.copyFrom(point[0]);witty-island-52596
02/15/2023, 10:54 PMbreezy-account-94066
02/15/2023, 11:06 PMhx
// Menu Tweens
public function openMenu(){
if (isMenuOpen == false) {
isMenuOpen = true;
FlxTween.tween(menu, { x:menu.x, y:FlxG.height - menu.height}, 1, {type:ONESHOT, ease: FlxEase.backOut});
}
else {
isMenuOpen = false;
FlxTween.tween(menu, { x:menu.x, y:0}, 1, {type:ONESHOT, ease: FlxEase.cubeOut});
}
}
Trying to set the position of the tween for our menu button that is grouped but can't seem to get the menu position can i gte some help?
hx
// Menu Box
var menuBox:FlxSprite = new FlxSprite();
menuBox.makeGraphic(FlxG.width, FlxG.height, FlxColor.GRAY);
menuBox.cameras = [uiCam];
// Menu Button
menuButton = new FlxButton(0, 0, "menu", function() {
openMenu();
});
menuButton.cameras = [uiCam];
menuButton.screenCenter(X);
// menu
menu = new FlxTypedGroup<Dynamic>();
menu.add(menuBox);
menu.add(menuButton);
menu.cameras = [uiCam];
add(menu);breezy-account-94066
02/15/2023, 11:07 PMcolossal-match-5265
02/15/2023, 11:13 PMFlxTypedGroup does not have a height nor an x. It is simply a group of FlxBasics for semantic grouping. (For update/draw order, and other iteration (collision, for example))
If you want to group things positionally, try FlxTypedSpriteGroup<> (which updates child positions when the parentx/y change) instead of FlxTypedGroup<> which youre using now.
--
Also, no need to use Dynamic for your group type. You know both of the things you add extend FlxBasic (a button and a sprite both extend FlxBasic)
https://api.haxeflixel.com/flixel/group/FlxTypedSpriteGroup.htmlcolossal-match-5265
02/15/2023, 11:13 PMwitty-island-52596
02/15/2023, 11:14 PMcolossal-match-5265
02/15/2023, 11:19 PMFlxGroup will not have an `x`/`y`, nor will it update children position, So I think the solution "must" use FlxSpriteGroup or some other method for updating all the children's x/y together
(FlxSpriteGroup is an alias for FlxTypedSpriteGroup<FlxSprite>, and FlxGroup is an alias for FlxTypedGroup<FlxBasic>, in case anyone reading is confused by our interchangeable use of them)breezy-account-94066
02/15/2023, 11:20 PMhallowed-holiday-15370
02/15/2023, 11:21 PMwitty-island-52596
02/15/2023, 11:22 PMbreezy-account-94066
02/15/2023, 11:22 PMwitty-island-52596
02/15/2023, 11:23 PMbreezy-account-94066
02/15/2023, 11:23 PMwitty-island-52596
02/15/2023, 11:23 PMhallowed-holiday-15370
02/15/2023, 11:23 PMwitty-island-52596
02/15/2023, 11:23 PMbreezy-account-94066
02/15/2023, 11:24 PMhallowed-holiday-15370
02/15/2023, 11:26 PMhaxe
class MyThing extends FlxSpriteGroup
{
public function new():Void
{
super();
add(new FlxSprite(0,0,"assets/image/image.png"));
add(new FlxButton(0,0,"Label", ()->{trace("click!");}));
}
}
somthing like that