Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / I'd like some 2d input

Author
Message
EightYearRecoil
19
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 7th Apr 2003 10:41
Hi all, I'm fairly new to DB, although I have a pretty good knowledge of the basic language (but I haven't used it in a few years). I've been trying to write a game engine in the style of old sierra games (i.e. Kings Quest and Space quest). I have my character who can walk up, down, left and right, plus move from screen to screen (I have a bitmap for each screen). I'm also going to deal with text or mouse input later, I'm just learning the basics right now. I wanted to know if anyone had any ideas on how to make the character walk behind things, and stop at obstacles. I have had a few ideas, but am not sure about the best way to go about this. I have read some stuff about grids, but I don't know if this would work for what I want to do. Any help would great. Thanks.

Eight Year Recoil
Ben
20
Years of Service
User Offline
Joined: 8th Dec 2002
Location: United Kingdom
Posted: 7th Apr 2003 15:57
You need to use sprites, cut out the image of say a tree, and stick it in a brand new bmp file, colour the background in black, to make it transparent, then paste it as a sprite, after you paste your character, then when you move your character up to the tree, your tree will be refreshed on top of your character, making it look like you character is behind the tree.



put a label in your main code, after your move commands (eg if upkey()=1 then xmove =xmove +1) but before your character sprite commands,
call it something like skipmove:
early in your code stuff, you find out what the exact coords of the stump are then you say
if xmove = treestumpcoordsx and ymove = treestumpcoordsy then goto skipmove

then when you walk into the stump your character wont be able to walk past it, so you have to hold the back arrow to make xmove a smaller number, letting you move again, Obviously that code is really messy as i just thought it up in 5 minutes, so you'll probably want to refine it somewhat.

Hope this helps, Ben

Tha D'lithi'om CRR'ist'lls Can'na Tek it Cap'n!
EightYearRecoil
19
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 10th Apr 2003 04:29
Thanks. That is probably what I'll end up doing. I was hoping to use a memblock or something, but I got that figured out (I think) and it just made it really slow. Hopefully using the sprites will not slow it down as much.

Eight Year Recoil

Login to post a reply

Server time is: 2023-02-04 21:11:01
Your offset time is: 2023-02-04 21:11:01