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.

DarkBASIC Professional Discussion / Need help with a maze game...

Author
Message
Ace121411
14
Years of Service
User Offline
Joined: 8th Oct 2011
Location:
Posted: 8th Oct 2011 15:50
I already have most of it worked out, u just cant seem to be able to make collisions work... Ive seen other posts about this, but i can really understand the answers, can someone fix my code and explain what your fix does?

Here is my code, i apologize in advanced for anyone offended by my code...


I don't always make games, but when I do I prefer TGC
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 8th Oct 2011 17:29
Hi there. I can't say I actually see the collision codes in that so it's a bit tricky to fix. I imagine that your mazel.bmp image is your entire maze right? If so that this is probably your problem. The native DBP collision commands use box collision which means that whenever the boxes of sprites overlap, they are counted as colliding. Thus, it makes no odds whether or not your player is touching what you've draw as part of the wall or as part of the background; once the play is in the maze, it will always be classed as a collision.

Now as I say, I'm guessing a bit here because I'm not entirely clear on what you want to achieve. However there are a few general suggestions I can give assuming that the above is in fact the problem. Solution 1: use tiles or a number of rectangular wall sprites to make up your maze rather than one big sprite. That way, DBP's box collision will work. Solution 2: use pixel perfect sprite collision. This can be achieved either using code snippets available here on the forum or from using a plugin that supports it such as eXtends. Solution 3: use line collision. This can be achieved either by writing your own line collision algorithm in DBP or by using a plugin such as the LineMap plugin by your truly

Hope this is helpful. Please do ask any further questions if you're still confused. If you do need more help though, it might help to provide us with a download with the media so we can have a proper look at what you're doing.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 8th Oct 2011 20:36
I suppose it depends on how you have made your maze. There are DATA collision maps where 1 = collide, and 0 = walk.

Ace121411
14
Years of Service
User Offline
Joined: 8th Oct 2011
Location:
Posted: 8th Oct 2011 21:10 Edited at: 8th Oct 2011 22:11
Quote: "Solution 3: use line collision. This can be achieved either by writing your own line collision algorithm in DBP or by using a plugin such as the LineMap plugin by your truly"


I will try that!! looks epic!!


edit:How exactly do i add this to my game though?

I don't always make games, but when I do I prefer TGC
Da_Rhyno
15
Years of Service
User Offline
Joined: 25th May 2011
Location:
Posted: 9th Oct 2011 04:46
Simple my good man, you follow the instructions included in the download for the plugin.
Lucas Tiridath
AGK Developer
17
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 9th Oct 2011 08:20
Quote: "edit:How exactly do i add this to my game though?"

Quote: "Simple my good man, you follow the instructions included in the download for the plugin."

That's certainly a good place to start! However if you have any issues at all understanding the instructions, please do just post again. I'd be happy to give you a run down of what it does or explain anything .

Ace121411
14
Years of Service
User Offline
Joined: 8th Oct 2011
Location:
Posted: 9th Oct 2011 18:44
Quote: "That's certainly a good place to start! However if you have any issues at all understanding the instructions, please do just post again. I'd be happy to give you a run down of what it does or explain anything"


I installed the plugin and traced my maze thing, how do i add it too my game

I don't always make games, but when I do I prefer TGC

Login to post a reply

Server time is: 2026-07-11 14:36:52
Your offset time is: 2026-07-11 14:36:52