Yeah, I just made a new project just to test that because it was working just close enough to correctly to make me think I was just crazy, but itās definitely broken:
It doesnāt even work when they are in the exact same place
Luckily this is the perfect reason to test out the debugger, so itās actually good that I have some reason to use it without having to make some huge project quite yet
In JS, numbers go up to 17 digits of precision, and then it starts bugging out. So maybe it has to do with that?
Hmm, I tried opening it in my browser, and it doesnāt want to play at all. Interestingly, it throws a console error because thereās no variable named main:
// Uncaught ReferenceError: main is not defined
function playHandler(event) {
if (event) {
event.stopPropagation();
event.preventDefault();
}
if (!project_screenshot || !main) return false; // <---- error here
project_screenshot.remove();
// ...
Not really sure what that means, but judging by the variable names in the loop, I guess it has to do with the project thumbnail?
Right now I am thinking of change_scene(to: Next_scene) but that is not very intuitive I think, but I canāt really think of anything else better.
Itās quite a weird block in the actual app editor too, the next and previous scene keys are the same shape/color/group as the keys for each individual scene.
Scene first_scene:
text text(x_position: 512, y_position: 384, text: "This is the first scene"):
When is_tapped(Screen):
change_scene(to: Scenes.Next)
Scene second_scene:
text text_2(x_position: 512, y_position: 384, text: "this is the second scene"):
When is_tapped(Screen):
change_scene(to: Scenes.Previous)
change_scene(to: Scenes.first_scene)
because it is more consistent ways to refer to variables (Game.variable_name etc.) and easier to implement. I donāt really like how different from hopscotch it is though.
One of the things I hope to do by april is to start on a typescript library to make it easier to interact with the project json and use that for the big refactor Iām planning.
If you were to use something like that, how would you want it to look like? Ideally it wouldnāt require very in-depth knowledge of the specific internal structure of the project to do simple things.
That depends. Are you thinking about making a middleware lib that works kind of like a backend for AEās Project Explorer? Or is it even lower level than that?
I think either way, it would be really nice to have a lower-level API like that, which could be applied to both the development of other custom codegen tools, as well as Hopscript. :)
If you write it in something like C or Rust, that would be even more of a bonus so I could write my own native frontend from that lib! IDK if itās worth dealing with interop though, or the learning curve for that if you donāt know those languages.
Iām gonna have to take a look at this much closer before I can give more specific advice tho.
My biggest struggle has always been project updates - (unless they added drafts for uploaded projects and I missed that), you can only work in small patches at a time and thatās really tough
Iām thinking mostly a library to make working with hopscotch projects easier, so something (ie hopscript) would interface with this library to create a hopscotch project, sort of like:
let project = HSProject()
let scene = project.addScene(named: "Scene 1")
let object = scene.addObject(named: "Spooky gorilla", type: .frankenrilla, xPosition: 100, yPosition: 200)
// Add code to the object, add more objects, etc.
...
print(project.jsonify()
so a library to make dealing with hopscotch json easier, instead of having to reimpliment a whole bunch of that functionality in every project.
Yeah, I originally wanted to make something like this in swift, but because I want to use it for hopscript which I eventually want to be usable from the web I figured itād be easiest to make it in typescript.
Do you have any specific ideas of what you would want to be able to do with it? Ideally the most common tasks would be pretty easy and simple to get done
pretty much what you just described, library bridging the gap between hopscotchās json and exterior programs, with either hopscript or userās choice as the frontend.
for specific ideas, support for secret blocks, and perhaps operations that normally wouldnāt be possible in the hopscotch ui but still work internally? (unsure of a good example, perhaps complex conditionals like when is pressed and 7=7? if the handler for those doesnāt like that then itās not an issue :)
essentially tools to get as much out of hopscotch that we can, especially that which is hard to work with in the native editor
Yes, you would definitely be able to do whatever is possible. Youād be able to use any block id anywhere, even if ti wouldnāt actually do anything in the app ā actual usable blocks, secret blocks, nonexistent/modded blocks, etc. Obviously it would provide an enum or something similar with a collection of known ids, but if you want to do something else you can. Specifically in my hopscript implementation the actual blocks are defined in hopscript code so being able to use arbitrary block ids is essential for even the very first use case.
I donāt think that when is pressed and 7=7 would work, as far as i know is pressed isnāt a boolean, itās specifically activated when a press is detected.
If you want it to be native, you could look into WebAssembly! It lets you compile your native code into a virtual machine that works across browsers.
I want to make different tools for Hopscotch games. Level editors, animation editors, stuff like that. HSAPI would make development on these things trememdously easier. :D
So for example, I could add Tiled support into Hopscotch using the API if I wanted to! Breaking out of the confines of the Hopscotch editor itself would be massive for the work I dream of making.