0

Hi I have to implement a game where the user has to move one object to a given goal using the arrow keys. I have to use sprites for my moving object and for your goal. Use an image as background. When the sprite touches the goal it must display a text telling the user he has complete the game. This is what I have so far

#include "DarkGDK.h"

const int superman_starting_X =200;
const int superman_starting_Y = 100;

void CreateSprites();
void getsupermancoordinates(int &, int &);


void DarkGDK()

{ 
int supermanX =superman_starting_X;
int supermanY =superman_starting_Y;

dbSyncOn();
dbSyncRate(60);
CreateSprites();

while(LoopGDK())
{
getsupermancoordinates(supermanX, supermanY);

dbSprite(2, supermanX, supermanY, 2);

dbSync();
}


}

void CreateSprites()
{

dbSetImageColorKey(255,255,255);
dbLoadImage("clouds.png", 1);
dbLoadImage("superman.bmp", 2);

dbSprite(1,0,0,1);
dbSprite(2,200,100,2);
}









void getsupermancoordinates(int &x, int &y)
{
if(dbUpKey())
{
y--;
}
if(dbDownKey())
{
y++;
}
if(dbLeftKey())
{
x--;
}
if(dbRightKey())
{
x++;
}
}

My sprite is an image of superman flying around space.
The professor gave us an example http://www.sci.brooklyn.cuny.edu/~dzhu/cs151/Homework%204.htm

2
Contributors
1
Reply
4
Views
4 Years
Discussion Span
Last Post by Phaelax
0

So are we suppose to run your code and figure out what you haven't finished yet or what? You told us what the goal of the code is. But what does it do when you run it? What specifically do you need help with? We're not going to do your homework for you.
And you might get more help with DarkGDK at their official forums, which is fairly active.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.