miskatonicstudio / molecules

The Unlicense
16 stars 3 forks source link

Release the game on mobile #14

Open miskatonicstudio opened 3 years ago

poetaster commented 1 year ago

If you guys ever have time, I build a version (with 3.2 & 3.5) which is mobile https://github.com/poetaster/molecules

miskatonicstudio commented 1 year ago

Thanks, I'll check it ;)

miskatonicstudio commented 1 year ago

Is there an .apk file available, or is it just an adjustment of controls to mobile devices?

poetaster commented 1 year ago

Ah, sorry I only build it for Sailfish OS. No Android here. I've adjusted layouts a bit and had to remove the old menu system which was interfering with touch handling. I'm using a touch library which I use in other projects as well. I also added score keeping and introduced dynamic behaviour of the molecules (a number of molecules move whenever you do).

I messed up a bit in managing the repo so I've detached it and think it makes sense for me to:

  1. fork again and branch
  2. add the score saving changes PR
  3. add the other molecule dynamics PR

The rest of the changes aren't really useful to you in the form they are in. Though, if you have and android sdk you should be able to deploy it from a 3.5 godot build. I have the templates for export but not the SDK.

miskatonicstudio commented 1 year ago

Which version of Godot are you using for this project? I imported it in 3.5.1 and got an error about InputEventMultiScreenDrag not being declared :(

poetaster commented 1 year ago

Ah, did you pull the submodule? I'm using a touch event detection library .....

miskatonicstudio commented 1 year ago

I did pull it, thanks! But now it's complaining about the lack of the Player class ... Is it something available in the newer version of Godot?

poetaster commented 1 year ago

Ah, sorry, I just checked. I had neglected to add it :) It's in the repo now!

miskatonicstudio commented 1 year ago

I managed to start the game, thanks for the missing piece ;) I am not sure yet how this touch event detection works on a desktop version: the propelling system kinda works, but in random directions ...

I also noticed that clicking the mouse wheel generates a new level, was that intentional? :) Because it looks cool ;)

poetaster commented 1 year ago

I managed to start the game, thanks for the missing piece ;) I am not sure yet how this touch event detection works on a desktop version: the propelling system kinda works, but in random directions ...

It's tricky, but in the touch adaptation, I set it up so that you drag 'behind' the particle, away from the direction you want to go. And the propulsion was modified. I need to look it up.

Because I had such issues with the menu (had to blend it out altogether to get touch events propagating properly) I wasn't that careful about maintaining desktop compat.

I also noticed that clicking the mouse wheel generates a new level, was that intentional? :) Because it looks cool ;)

In touch, two finger touch allows you to skip the level (some are basically impossible). So if you're playing for the score board and it looks undoable, you can skip. Also, if you're about to die, you have a cheat out (if your fast enough) :)

poetaster commented 1 year ago

Ah, just tried, my propulsion method works fine on desktop, but it IS different from the way it was designed.

I radically simplified :-) Moved from _physics_process to:


func _on_touchTap(event):
    if is_main:
        # using event.relative gets us a range
        # of propulsion from drag direction
        self.propel(event.relative)
    pass

KISS ;) But it does confuse people on first play who want to go in right, so they tap right :)

poetaster commented 1 year ago

And, in game.gd , in the _input handler I added some random movement (from level 4 on) with a bit of a hack:


        emit_signal('touchTap', event)

        # we add some random motion the larger the
        # main molecule gets. we limit selection
        # to the number of wins.
        randomize()
        if wins > 3:
            # select a random molecule
            var rMolecule = molecules.get_child(randi()% wins)
            if not rMolecule.is_main:
                # a small delay so that main move
                # and the other molecules aren't contemporary
                rMolecule.propel(Vector2(rand_range(-1,1), rand_range(-1, 1)))