Im thinking of adding a level editor to the menu I’m creating
Boy am I happy to know you’re doing this in JavaScript, as this most likely wouldn’t be possible in blocks. Specifically the slider thing. That also sounds like a cool idea I might want to use sometime, so I’m gonna make a small mock up of how I would do it. I’ll try to add comments to explain what’s happening!
Here you go:
I made the volume wrap around, but you can easily change that in your code if you don’t want that.
This is awesome, it feels like a real xbox game
This is a simple test (made on a phone):
@WoofWoof, i created a class to handle the menu easily. Of course, you can access the miniMenu variable inside it and do whatever you want with that, but the whole purpose of the class is to simplify some of the variables / functions. I made it have 4 variables that can be changed and range from 0 - 255
@WoofWoof, here is the finished test of what i was meaning to do:
It took too long… but its so easy too use now!!
Great game! also, can you please tell me how you made the moving platforms?
sadly, I don’t remember but you could probably ask someone else, or attempt to understand it. I could also look over it to remember what it does
@WoofWoof, can you help me make it automatically choose positions for the menus, so that it actually looks like a tree? I want it so that the top of a sub menu is to the right of the selected item of the menu that opened it, but so that its touching. I cant figure out what to do if the menu reaches the bottom of the screen and goes past it, so if you have any ideas can you explain them?
I had to figure out this exact thing when I made my mini menu cursor extension. There is a variable attached to menus called “scroll” or something like that and to get the y position of any menu element you do “menu.top - menu.scroll + the width of the title element” and then you add the height of every menu element up to the one you want and bam, you have the y position of the menu item.
I don’t remember the actual function names, but I know there is some sort of scroll variable and a function for getting the height of a given menu element.
does each item not have the same height?
If you are trying to create something that other people can use, you have to take into account that you can put images into the items, which changes their height. (You can also change the font sizes technically)
oh you made this in js… this makes it more impressive
can you send me an example project that gets the position of a menu item, or something you’ve already built that does that
i use javascript because it allows things like classes or switch statement
@Iro, here is what the platforms do:
its in the update function
These levels make me want to expire with their difficulty
Yes. I have made an extension. WoofWoofCodes/pxt-mini-menu-cursor
From what I remember, the code for finding the Y level is sorta used in stages that are split up, so it might be a bit all over the place. The general code for this starts at line 28 of the miniMenuCursor.ts file. I also never directly find the Y value of the elements. Instead, I find out which element should be selected by increasing that menuPos variable until it is larger than the Y value of the cursor. After a bunch of setup to find the Y position where the items actually start, this code around line 72 loops through each one to add up the height:
But this is just the case for the normal single column menus. My code accounts for every type of menu that can be made! Feel free to copy any and all of my code, just give credit in a comment somewhere if you do!
I think the function gets an item depending on the cursors position, by getting every items position and checking if it’s close. what I want is getting an items position, which can be used with that?
