I was wondering are there an easier way to create a map the doesn’t use table and excel spreedsheets. Like maybe an app that lets you build it then translate that into code for codea?
@Dezmo - are you talking about a maze or a terrain ?
Terrain, sidaewsys or vertical levels
i use Procreate and Affinity Design, you can make your tile map or whatever you want in Affinity because it’s more vector and math based, but both export to PSD and then you can also get Pythonista and StaSh and psd_tools to perform some python exporting on the psd file(s) and out put yourself generated code for codea, ive done it myself but i also wrote my own data structure that’s pretty specific to my usage so you would have to spend some time to figure it out and customize it for yourself — mmm most of this might require ipad not iphone sorry
I actually do also have an iPad, so this is still quite helpful. I wish Codea have something similar to Tiled though, but I’ll see if I can figure out a way to do this
@Dezmo - if you are talking Tiled it shouldn’t be too difficult to build our own version.
I have played with using a 256 b&w image to display sprites from a sprite sheet and got it to work but it was messy. I resorted to building data files in tables for each level so you could have one for terrain and one for objects. Never really finished the projects though.
@Bri_G could I see an example if possible?
@Dezmo - after re-reading your thread I realized that you don’t want to use tables. Unfortunately tables are required to build up a map in the first place and then convert the tabled data to a graphic for a more compact map data storage.
Found a simple table storage method I wrote some time ago if your interested.
You might consider modifying the sprite designer in the recent thread to operate using sprites and saving the data table for use in a 2D terrain project.
@Dezma - OK, thought about doing something like this for a while. Don’t have a lot of time but started putting something together. Stage 1 a mock-up to work out how it would look and operate on an iPad. So using the resources in Codea built one up (operating in landscape mode). Don’t know if this would be operable on an iPhone and would need scaling to screen size anyway. At the moment it doesn’t do anything and needs a lot of cleaning up. CTiled.
Please give feedback and anyone feeling enthused or impatient - please make/add any code/changes you feel will help. I was hoping this could be a users project.
Image and first stage attached.
Agree with the comment about tables - these are pretty fundamental.
In this example, the approach is to store info about the map as a series of brush objects, having an x and y coordinate in the map. You then call a function to generate the map by placing the appropriate brushes (tiles) at the correct coordinates. This wouldn’t be the approach I would adopt for a platformer/dungeon crawler but seemed to work well for lemmings type games, which will contain destructible domain and collisions are managed by querying an image at a pixel level.
It’s not a polished bit of code - but might give you some ideas
@West - that’s pretty neat, some instructions would help - like what all the controls do. I think you must be on a higher res pad than mine as the icon bar disappears into right hand side of screen.
Will read through your code to see if I can get some hints on my prototype.
Thanks for that.
@Bri_G I’m on an iPad Pro.
You should be able to change the 1024 on the panel setup call - it might squish the icons a bit, but I hope the interaction will scale. The passed parameters are bottom left x and y of the control panel, then width and height.
Reading left to right the controls are:
Unused (was set entrance position for lemmings editor)
Unused (was set exit position for lemmings editor)
Snap to - forces a grid - tapping cycles through grid sizes as indicated by the number. 1 is no snap to. Could do with an overhaul as am basing location on centre, rather than corner of tile, which means swapping say 8 and 16 doesn’t scale correctly (it offsets the 8x8 by half a tile, rather than splitting the 16x16 into 4 8x8)
Brush - tap to cycle through the current brushes
Delete - removes everything from that tile location - again limited - you can add multiple brushes to a location
Move - move content from one tile to another location.
Left - moves map left (is to accommodate maps which are larger than the current screen - fancier touch based scrolling would make for a better user experience)
Right - moves map right
Up - moves map up
Down - moves map down
Save - Saves the current map
Reset - deletes all content - requires a quadrouple tap to execute
Exit - back to the main menu - doesn’t autosave! A warning here would improve things
It’s rough and ready and was designed for a specific used case so might not suit
@West - thanks for the details, makes code digestion a little easier. Any mods I make I’ll post.