Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


endless11111

Member Since 04 Apr 2012
Offline Last Active Sep 18 2014 03:43 PM

Topics I've Started

How do you make an AI follow an A* path in a 2D platformer game

21 December 2012 - 05:51 PM

I am currently working on a 2D platformer game and i was hoping to have AI that could follow the player instead of mindlessly moving side to side in the map. I looked into astar pathfinding and i managed to make a simple pathfinding system for an overhead game. The thing i am having trouble with is getting the AI to follow the path in a 2D platformer. I can make simple AI follow paths on overhead games, but i have no idea how to do this in 2D. how do i make the pathfinding itself calculate gravity, jumpheight, pitfalls and all of the other 2D obstacles? also how would i make the AI even follow a path like this? i would like to make an AI like the one in this video  . if it makes a difference i use c++.


How do video games render different equipment on players?

12 July 2012 - 12:02 AM

how do games such as RPG games show the characters wearing different equipment? do they have a separate image for a character wearing all the different combinations of equipment or is the equipment just an overlay that's stuck on to the character and moves along with him?

how do i save levels in a basic platformer game using c++ and SDL?

05 July 2012 - 02:35 PM

I am fairly new at programming games, and so far i have programmed basic games like pong. right now i was working on a small platformer game. right now i use a basic level creator that i made to create a level on the fly, and it's really annoying to recreate a level every time i compile my game. could anyone please teach me how to save my levels and load them so i dont have to recreate a level over and over again?

Pong with SDL collision help

22 April 2012 - 03:00 PM

I am currently trying to learn to use SDL, and right now i am trying to make a pong game. i know how to do the collision, and it works fine with the front or back of the ball with the front or back of the two paddles, but when it hits the top or bottom of the paddle's the ball goes through the paddles. i was wondering if anyone knows a way to stop the ball from going inside the paddles. also if you dont move the ball bounces off properly, it only happens when you move. here is my ball's movement code.

void ball::move(SDL_Rect rwall, SDL_Rect lwall)

{

	//move the ball and limit the speed

	ballbox.x += velx;

	ballbox.y += vely;

	//check to see if ball hits any of the walls

	if(ballbox.x <= 0) //left wall

	{

		ballbox.x = startx;

		ballbox.y = starty;

		velx = -velx;

		rpoints++;

	}

	else

	if(ballbox.x + ballbox.w >= screen_width)//right wall

	{

		ballbox.x = startx;

		ballbox.y = starty;

		velx = -velx;

		lpoints++;

	}

	// make the ball bounce if it hits the top or bottom

	if(ballbox.y <= 0)

	{

		ballbox.y -= vely;

		vely = -vely;

	}

	else

	if(ballbox.y + ballbox.h >= screen_height)

	{

		ballbox.y -= vely;

		vely = -vely;

	}

	//check for collision with the player's pads

	//collision with front or back of right pad

	if((ballbox.x + ballbox.w >= rwall.x) && (ballbox.x <= rwall.x + rwall.w) && (ballbox.y + ballbox.h >= rwall.y +5) && (ballbox.y <= rwall.y + rwall.h -5) )

	{

		ballbox.x -= velx;

		velx = -velx;

	}

	else

	//collision with top of right pad

	if((ballbox.x + ballbox.w >= rwall.x)  && (ballbox.x <= rwall.x + rwall.w) && (ballbox.y + ballbox.h >= rwall.y) && (ballbox.y + ballbox.h <= rwall.y + 5))

	{

		ballbox.y -= vely;

		vely = -vely;

	}

	else

	//collision with bottom of right pad

	if((ballbox.x + ballbox.w >= rwall.x) && (ballbox.x <= rwall.x + rwall.w) && (ballbox.y <= rwall.y + rwall.h) && (ballbox.y >= rwall.y + rwall.h - 5))

	{

		ballbox.y -=vely;

		vely = -vely;

	}

	else

	//collision with front or back of left pad

	if((ballbox.x + ballbox.w >= lwall.x) && (ballbox.x <= lwall.x + lwall.w) && (ballbox.y + ballbox.h >= lwall.y +5) && (ballbox.y <= lwall.y + lwall.h -5) )

	{

		ballbox.x -= velx;

		velx = -velx;

	}

	//collision with top of left pad

	if((ballbox.x + ballbox.w >= lwall.x)  && (ballbox.x <= lwall.x + lwall.w) && (ballbox.y + ballbox.h >= lwall.y) && (ballbox.y + ballbox.h <= lwall.y + 5))

	{

		ballbox.y -= vely;

		vely = -vely;

	}

	//collision with bottom of left pad

	if((ballbox.x + ballbox.w >= lwall.x) && (ballbox.x <= lwall.x + lwall.w) && (ballbox.y <= lwall.y + lwall.h) && (ballbox.y >= lwall.y + lwall.h - 5))

	{

		ballbox.y -=vely;

		vely = -vely;

	}

}


Am i learning too slow?

12 April 2012 - 03:29 PM

I have been learning c++ for 3 or 4 months now, and frankley i haven't learned too much. i used the book accelerated c++ and i am nearly done
the book, and so far i have only made a few small projects like tictactoe and all the other begginer projects. I have read so many times that someone has been learning for only 2 or 3 months and they already made a simple game with sdl, so i am just wondering, am i doing learning too slowly? or are the other people just learning really fast?

PARTNERS