Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Touchscreen Controls to HUD #15

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Conversation

jbourqueendless
Copy link
Contributor

  • Introduced touchscreen controls for the game by adding TouchScreenButton nodes to the HUD.
  • Controls include buttons for movement (left and right) and a jump action.
  • Buttons are positioned as part of the HUD layout and are only visible on touchscreen devices.
  • Tested functionality on desktop (using "Emulate Touch From Mouse") and mobile device.

@cassidyjames
Copy link
Member

Ooh, neat idea! It looks like your PR added a bunch of unused assets and the block-code addon as well. 😅 I can help you clean it up if you'd like, because I think this is a nice idea (and the clean-up process will be… informative? lol)

(@endlessm/endless-developers: we should probably .gitignore addons/?)

@jbourqueendless
Copy link
Contributor Author

OK I gotcha. So between the block coding and the images that came with the interface button asset pack what should be removed? All of the block coding plug in and any and all images not directly used or?

@cassidyjames
Copy link
Member

@jbourqueendless full disclaimer: I haven't downloaded this branch to play with it yet. But generally, yeah, I would remove the block coding plugin, and then maybe instead of keeping all of the assets in their original locations/names (like assets/Touchscreen Controls/kenney_onscreen-controls/Sprites/flat-dark/flatDark05.png), I would only import the specific assets you're going to use, and name them something simpler (like assets/controls/05.png).

@manuq
Copy link
Contributor

manuq commented Dec 4, 2024

@jbourqueendless yes, as @cassidyjames said, only git add the needed assets for the 3 buttons. Ideally with the same file name format as the existing assets, something like:

assets/hud/touchscreen-button-left.png
assets/hud/touchscreen-button-right.png 
assets/hud/touchscreen-button-a.png 

@jbourqueendless
Copy link
Contributor Author

Ok I have removed all but a small selection of control button pngs from the asset pack. I also reorganized them and renamed them (which I am adding here because I forgot to mention that in the commit message :-/ ). Block coding plugin and files are also removed.

@wjt
Copy link
Member

wjt commented Dec 4, 2024

(@endlessm/endless-developers: we should probably .gitignore addons/?)

In this one we don't use any addons right now, but in moddable pong we do: https://github.com/endlessm/moddable-pong/tree/main/addons/DampedOscillator. I don't think ignoring it would be right.

project.godot Outdated
Comment on lines 34 to 35
switch=""
animator=""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this (and the addition of switch.tscn) are also not meant to be part of this PR.

assets/controls/flatDarkB.png.import Show resolved Hide resolved
switch.tscn Outdated Show resolved Hide resolved
@wjt
Copy link
Member

wjt commented Dec 5, 2024

I've tested this on my laptop touchscreen: it looks great. With the stray changes removed, I'd say it's ready to (squash and) merge.

@jbourqueendless would you like me/us to take care of the stray files and/or squashing? Or do you want to do either/both?

@jbourqueendless
Copy link
Contributor Author

jbourqueendless commented Dec 5, 2024

That's ok I will remove the scene file and squash all these little commits.

@jbourqueendless jbourqueendless force-pushed the examples/touchscreen-controls branch from 6ea3c1e to 2f214a5 Compare December 5, 2024 13:39
- Added PNG assets and nodes required for touchscreen controls.
- Implemented three touchscreen buttons using Control UI and button nodes.
- Enabled touchscreen-only visibility and updated unhandled input logic for HUD.
- Adjusted buttons for better alignment and functionality.
- Removed unused assets, files, and scenes accidentally included in the project.
@jbourqueendless jbourqueendless force-pushed the examples/touchscreen-controls branch from 2f214a5 to d1a0522 Compare December 5, 2024 13:57
Copy link
Member

@wjt wjt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@wjt wjt merged commit 7a94e99 into main Dec 5, 2024
1 check passed
@wjt wjt deleted the examples/touchscreen-controls branch December 5, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants