Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Môsi

A tiny game editor you can use on your phone or in your browser · By sg

The engine is very cool! And I have a couple of wishes for scripts.

A topic by Vlas_Z created 51 days ago Views: 90 Replies: 4
Viewing posts 1 to 2
(1 edit)

It would be great to be able to:
1. write a script on the avatar. (For example, "{if {avatar-moved right}} ... {/if}")
2. commands to get a palette or music in the room.
3.and cycle in any form.

Hi Vlaz,

I don't think you can write a script on the avatar, though you can do something similar if you attach a script to the floor that they're walking over constantly. I did something similar with my game here: https://danwinters.itch.io/heal

Essentially, the floor script had variables that kept the X and Y variables of the avatar generated with {avatar-x} and {avatar-y}. I would then check that variable on the next floor tile against the new values of {avatar-x} and {avatar-y}. For instance, if the previous X variable was 3 and the current {avatar-x} variable is a 4, then I know the avatar has moved right. If it's 4 to 3, then they've moved left. Same thing with the Y variables also.

You can change colors and music, using this like: {set-sprite-color 2}
and {set-music room-1-2 song-2}
. The documentation for those are here: https://github.com/zenzoa/mosi/wiki/Scripts

As for a cycle / loop, I'm not sure there's an easy way around it I'm afraid. It might be possible to do something via 'Custom Scripts' though I'm not sure.

Yeah, I just see one of those games on Mosi and realized that transparent sprites can be used that way, but that's just my wishes for the game engine. As for custom scripts, they either don't work right or I don't understand something, but the game just doesn't start when I want to add them. If I could figure it out, I might write simple {get-palette-in-room}, {get-sprite-color} and {get-music-in-room} so as not to create extra variables for such needs.

A custom script for {get-palette-in-room} could just be:

return game.currentPaletteIndex;

I believe. It needs to be javascript in there and the 'return' is there as that's what a javascript function sends back. It does send back the index though, so if it's the first palette it will send back 0, the second will send back 1, etc.

The two main objects that hold information in Môsi seems to be 'game' and 'context.' If I look at the 'context' one, I believe the following should return the color of the sprite:

return context.sprite.colorIndex;

Oh, thanks! I think I'm starting to understand how this works better.