Table / Double Alcove code

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
ebeneezergude
Expert
Posts: 345
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Table / Double Alcove code

Post by ebeneezergude »

Hi all, I'm planning on making a stone table custom object in DSB. Have looked over the code for the double alcove wallitem object from Sophia's Test Dungeon, figuring I would need to employ some similar code for a table onto which objects can be placed, but make it a floor standing object instead of a wall item (using a THING type?). Is this essentially the right way to go?

In terms of the gfx offsets.... in the Test Dungeon doublealcoves.lua file, one of the alcoves has: .y_off =-40

...for it's custom bitmap for 'alcove_short_front'. I assume this means draw bitmaps 40 pixels below a reference point...?

The other alcove - 'alcove_short_front_top' - has: .y_off=72 I assume means 72 pixels above a reference point...?

Can someone explain the basics of bitmaps placement and principles behind the co-ordinates?

Thanks! :-)
Last edited by ebeneezergude on Sat Feb 23, 2013 1:11 am, edited 2 times in total.
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Table / Double Alcove code

Post by Sophia »

You've basically figured it out.

Wallitems are, by default, drawn in the center of the wall. Most items "just work" without need of any explicit offset.
The two alcoves need explicit offsets so one is drawn higher and the other is drawn lower.

The only thing you've gotten wrong the axes: 0,0 is in the upper left corner, so negative is up and positive is down.
Post Reply