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.

Dark GDK / Making a map for a 2d Side scroller

Author
Message
KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 20th Jun 2009 10:56
I am having trouble finding code to execute my idea of making the map to a 2d side scroller.

My goal is to have ground that can have gradual inclines and slopes. Tiled maps seems like they would be a difficult way to get this goal.

My idea is that I could have a hidden image on screen that had only two colors (White and Black) Black would represent all collidable map objects. I could then get some code (and this part is my problem) that would be able to return the color of a specific pixel on a specific Image. I could then use that information to get the characters to collide with the ground. I can not find any code that will accomplish this for me.

Anyways, if anyone could help me get this code or tell me any other way to reach my goal, I would be very happy (Whether it is through my idea or any others).
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 20th Jun 2009 17:54
Searching the Dark GDK help for "pixel":

int dbPoint ( int iX, int iY )
This command will return the pixel color value from the screen at the specified Coordinates. You can also read from bitmaps by using the dbSetCurrentBitmap command.
KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 21st Jun 2009 06:09
I've been trying to get dbPoint to work for the past 10 hours (with a few breaks inbetween). It doesn't seem to work.

The help doc says that dbPoint returns an int but looking on the popup when you are entering the parameters it shows that it outputs a DWORD. After researching what that is, I am under the impression that it would print out the color value in 4 sets of 8 bit numbers. Checking what the output is when I do something like "double d = dbPoint(20,20);" d is usually a number that would be something like 255,0,0,0. I am guessing one of those sets is a value for transparency. Anyways the dbPoint function hasn't seemed to return any value that I could use to check the color of anything on screen.

If there is something I am missing let me know. Here is some test code I have been using to get the value returned by dbPoint. I use a watch on the variable i and a breakpoint on the line i=i (Just useless code to get a breakpoint where I want it.



---

Is there any other way I could do this (Second paragraph in my OP)?
KeiNagase
15
Years of Service
User Offline
Joined: 15th Jun 2009
Location:
Posted: 22nd Jun 2009 11:00
Ah. I got it working sort of. If I can actually get it working well I'll post instructions on how to set this up.

Currently I am relearning c++ and its a little difficult learning to make the code look neat and understandable.

Login to post a reply

Server time is: 2024-11-25 08:38:23
Your offset time is: 2024-11-25 08:38:23