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 / Map Making

Author
Message
SamAllmon
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 26th Aug 2009 06:38
I'm making a 2D Puzzle game, similar to Oddworld: Abe's Oddysee.
And I am very new to Dark.
I know my way around C++, it's just the dark Specific stuff I'm having trouble with.

So, without giving me Code to Copy Paste, I wanna feel like I dominated it, can you help me figure out how to do this.

I need my Character to walk in a grid, but smoothly walk from square to square.
And it's a side-scroller.

I know I'll have to make an array, and that'll be the coordinate system in which he walks, but too much more beyond that, I don't know.

One Idea I have, is that I just have a 1D array, that stands for x coordinates.
And then, My character can move freely, but when He stops, I divide his x coordinate by the grid, and then round up, and make him stop in the corresponding column.
But rounding up would only work for one direction.
Though, I could make a test to see if he's going right or left.

Is there a rounding function for C++, or would I have to divide integers, then see if the Remainder = 0, and if not, Add 1?
I'm gonna try this, and Post my results.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Aug 2009 11:18
You said in a previous post that you had used allegro to do the same thing almost that you are asking here... I have used allegro myself a little(I prefer GDK personally though) and it is very similar to GDK.

I think for a game as simple as you are asking about, the logic that you followed in allegro, would also apply in GDK, at least from the point of view of how you setup your arrays and the algorithms etc that you will use, the maths for movement etc etc....

The only things that should be actually different would be assets, like your images and objects etc, and how you handle them, load/position and the command names to affect them.

If you can figure out most of the equivelant commands in GDK to achieve similar things to what you did in allegro, you should have no problem, like the commands that you used in allegro to generate your map, most of it should be able to translate directly to GDK, just changing how you handle the media for it and how you detect the input.

If you were using an external lib like MappyAL for your map, then as far as I know GDK doesnt have a mappy wrapper, but DBPro does and it wouldnt be hard to convert it.

If it ain't broke.... DONT FIX IT !!!
SamAllmon
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 26th Aug 2009 20:22
Yes, I achieved it in Allegro, But it "teleported" the player forward to the next square, not a fluid transition.
The code And such I'm looking for pertain to making the player look like he's walking one square, then stopping.

I could combine my animation and movement into one function, and do like:

If you press right, you move 1px right, and show frame 1, then 1px more, frame 2, then 1px more frame 3, and so on. and then for the last frame, instead of moving such and such right, you move to the spot on the grid.

Or, I could do it all by the grid.

Press right = 25% moved, 1st frame, 50% moved 2nd, etc.

That sounds promising.
It might give me problems when I get to a second floor on one level, or something, But I don't think it will, as long as I keep the X value the only one bound to a grid.
That way, jumping and climbing can be anywhere.
SamAllmon
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 27th Aug 2009 01:07
I stopped worrying about the Movement, and decided to just get the Level Drawn.
So I made me a simple Brick Tile in Photoshop, and made an array to draw where they go.
Taking what I did in Allegro, and putting it in GDK terms.
IT FAILED.

It works in Allegro, So the logic is right, I'm just either not putting it in GDK form correctly, or Not in the right place in the program.



Help me, please.
More than likely, it's something stupid, and I don't see it.
SamAllmon
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 27th Aug 2009 04:55
Got it. I needed to use dbPasteImage();
Woo!
Now I have a map, and a player that teleports.
I could begin on a simple puzzle, but the animation thing looks like a doozy, so I wanna get it out of the way now.
Blaze 0_o
15
Years of Service
User Offline
Joined: 27th Aug 2009
Location:
Posted: 28th Aug 2009 05:14
Cool Good Luck
SamAllmon
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 28th Aug 2009 21:41
I still need help with the Walking thing, if anyone has input on that.
The map is fine, but the character still sucks. XP

Login to post a reply

Server time is: 2024-11-20 17:22:56
Your offset time is: 2024-11-20 17:22:56