Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tilemaps with slopes
#1
Someone asked a while ago, on the old forum, if it could be made possible to use tiles with slopes with the Tilemap editor and library.

It is still not possible. And I think I'd rather write a new library than add support for it to the old one, since it would interfere too much with how it currently works.

However, I just made a "hack" where I handle slopes outside of the library. I have set up two tiles in the image sheet used by a map as slopes. These two tiles are NOT marked as obstacles in the tilemap editor, so without the hack, the player can walk right through them. Instead, I'm checking what type of tiles the player's left and right feet are inside. If they're in tiles with slopes, I move the player up to the correct position.

I've attached the example to this post.


[Image: tm_slopes.jpg]


Attached Files
.zip   tm_slopes.zip (Size: 20.03 KB / Downloads: 11)
Reply
#2
I added two more steps in the tutorial and updated the attached zip in the first post. The second step looks just like the first one (a dude that can walk and jump around on a static screen), but the dude is now animated. The third step uses a larger map with scrolling.
Reply
#3
Very cool.

On my machine, the little guy, moved like The Flash... very funny... inserting a 'wait 10' in the loop fixed the problem. Now I can actually see the animation... Nicely done, slopes and all... Scrolling was very smooth Wink

Quick question. Can the TM produce maps in layers? If not, I'm not requesting a re-write, just curious. I have a Tiled map that I would like to try...

J
Reply
#4
Thanks for this Marcus. One small question. When running example 3 in Windows, I get the following error message:
=== Compile using naalaa6.exe ===
Compiling E:\NaaLaa 6\aaa - template and examples\Tilemaps\tm_slopes\example_3.txt ...
ERROR on line 34:
Expected ')'

This is the line:
vSlopeInfo[cels(TM_GetImage())]

which I need to amend to

vSlopeInfo[cels(TM_GetImage()))]

It then runs fine, but I don't understand why the change is required, as it now looks to me as though there is one too many closing brackets? There is the same error thrown up in line 140. I am using the amended Tilemap lib that you posted recently for Windows. Apologies if I am missing something obvious.
Reply
#5
(02-16-2018, 04:05 AM)kcfb Wrote: Thanks for this  Marcus. One small question. When running example 3 in Windows, I get the following error message:
=== Compile using naalaa6.exe ===
Compiling E:\NaaLaa 6\aaa - template and examples\Tilemaps\tm_slopes\example_3.txt ...
ERROR on line 34:
 Expected ')'

This is the line:
vSlopeInfo[cels(TM_GetImage())]

which I need to amend to

vSlopeInfo[cels(TM_GetImage()))]

It then runs fine, but I don't understand why the change is required, as it now looks to me as though there is one too many closing brackets? There is the same error thrown up in line 140. I am using the amended Tilemap lib that you posted recently for Windows. Apologies if I am missing something obvious.

That's one of the bugs in the parser that's been fixed in the Linux version :Big Grin  It's caused by a really stupid typo in the sourcecode.

I hope I can pull myself together and focus on the Windows version this weekend.

The speed thing that Johnno mentioned has been fixed Smile
Reply
#6
Many thanks Marcus........I'm having fun using NaaLaa again
Reply
#7
Updated the zip again with a fourth example, added some simple enemies.
Reply
#8
Glad, that was cleared up.

 Works on Windows10 but...

 I changed the file extension to .txt and added a bracket in the places where I got an error.

 Nice work Smile
Reply
#9
Sorry about the issues on Windows Sad  My Windows computer doesn't feel too good at the moment, getting "blue screens" constantly. I hope I can still get the update out soon.
Reply
#10
Added two more examples to the zip. In number 5, the player is given the ability to crush brick and stomp enemies. In number 6, lifts are added.

Some more enemies, and maybe some powerups, and the base has been made for a completely unique game Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)