Mouse support and a game

291 views
Skip to first unread message

That Scar

unread,
Sep 28, 2018, 1:01:12 PM9/28/18
to PuzzleScript
So, I've made mouse support for puzzlescript, which was actually done in the past by Zarawesome here.

The main feature that I've implemented: dragging, in the sense that drawing in paint is _dragging_ your mouse (not to be confused with drag-and-drop).
I feel like this one feature makes it a lot more nice than Zarawesome's version and makes many games nicer simply by dragging the player instead of individual controls.

Here are three neat things that work on it really well right now and make me really excited for all of this:


PLAY!
Use the mouse even though it says to use the keyboard. Middle mouse to undo. You can still use keyboard in conjunction with mouse.


Mouse support for Train Braining by draknek: Play Hack




A puzzlescript port of Hanano Puzzle by qrostar: Play Hack




An original game/prototype called Arrow Game, concept and level design by TheGreatEscaper, implementation by ThatScar (me): Play Hack




MAKE STUFF!

It is not complicated to use but still needs an introduction:
mouse_left enables clicking the game, which generates an object named "lmb" (the editor asks you to have something named "lmb")
mouse_drag enables drawing after you have held down the mouse button, placing a "drag" whenever you move over to a new tile.
It's recommended (but definitely not required!) that you have these as new objects on new layers.
Then you can do whatever you want, go wild!

To make mouse support like I did for Train Braining, just follow those above instructions and add some simple code like this:
[ lmb ] -> [ ]
[ Player | drag ] -> [ > Player | ]
[ drag ] -> [ ]
That's really all there is to it, it's that simple to make mouse support for something that simple! You can pretty much put it on any small sokoban game and it will likely work.


IMPORTANT NOTES FOR MAKING STUFF!

You won't be able to share it as the github login only works for the original puzzlescript site but you can totally just copy-paste it into the original and press Share even if the original puzzlescript complains a lot and doesn't build.
Shared links will have a "hack" button but it will open a raw html file, which is why you need to prefix any page with "http://htmlpreview.github.io/?", I recommend to send both a play and a hack links like I did if you are actually sharing them.
This thing is brand new and as you edit games with this, you will very likely run into issues, it would help if you reported any new ones here.
If you have a simple feature request, especially one like "right click dragging, please", you should put it there as well to not waste space on this google groups page.

The issues that I am most interested in fixing right now, you are likely to run into these:
If you move the mouse too fast, it will leave gaps between the drag objects and nothing will fill it in; no object will magically follow a cursor it has lost track of.
Flickscreen/zoomscreen don't work.
It still tells you to use keyboard controls when you shouldn't...

Other Notes that aren't nearly as important:
For now, try to make the mouse objects alone on their layers to not introduce any weird bugs in your game.
I've added a prelude term "nokeyboard" which does nothing but make the compiler not complain about there not being a player in the game (keyboard will still work but when there's no player, it doesn't do anything at all).
You can use "undo" in rules, just like "cancel", "restart" and others (credit goes to zarawesome for this one).
Must have mouse_left enabled for mouse_drag to work properly.
Mouse action does not comply with require_player_movement.
I originally forked zarawesome's repository but because it was a bit hard to understand and I wanted something quite a bit more complicated, I started modding from normal puzzlescript and took only a few lines from zarawesome.
If you are looking at my source, be sure to use the "feat/mouse" branch because the "master" branch doesn't have the mouse feature.

HOPE YOU ENJOY, CHEERS!

Alan Hazelden

unread,
Sep 28, 2018, 6:16:43 PM9/28/18
to Skalmantas Šimėnas, PuzzleScript
On a touchscreen, it seems to still be using the existing puzzlescript behavior for "drag anywhere to fake arrow key presses". Is this intentional?

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

That Scar

unread,
Sep 29, 2018, 1:27:51 AM9/29/18
to PuzzleScript
Issue #9: Doesn't work on mobile https://github.com/ThatScar/PuzzleScript/issues/9
I just haven't lifted a finger to make anything work on mobile and it won't just magically do so (besides, it's complicated because I have to decide on how to separate the gestures or even create new behavior for normal movement)
Should've probably mentioned it as one of those "important" issues but, right now, it's far from my focus.
Reply all
Reply to author
Forward
0 new messages