Jump to content

  • Log In with Google      Sign In   
  • Create Account


manderin87

Member Since 20 Feb 2005
Offline Last Active Dec 14 2012 10:38 PM
-----

Topics I've Started

[android tablet] New game Astro Blaster released

14 December 2012 - 10:23 PM

My first game to be released on google play. The game is only available on tablets due to higher screen space required, however I am looking into making a version for phones.

Description
An asteroids - like game in which you destroy asteroids and survive for as long as you can. You control a gunship and collect power ups and survive wave after wave of asteroids coming from every direction in space. Explode asteroids in brilliant color and crystal shards. Can you survive the onslaught?

Avaliable here https://play.google.com/store/apps/details?id=com.projects.astroblasterdemo

Thanks

Polygon rotation is too fast compared to objects rotation

29 November 2012 - 09:32 AM

I am designing a game in android and I have a problem when updating a polygon that is used for collision detection. When the objects update method is called it rotates the object by .5 and then updates the polygon by rotating it by the same amount. The problem is on the screen the polygon is rotating faster than the object when drawn. The polygon is rotating so fast that it looks like a star, eventually it slows down and then speeds up again. It will not stay in step with the objects rotation.

This is the rotation code for the polygon.

public void rotate(float x0, float y0, double angle) {
  for(int i = 0; i < mOrigins.size(); i++) {
   Point point = mOrigins.get(i);
  
   float x = (float) (x0 + (point.x - x0) * Math.cos(Utilities.toRadians(angle)) -
				  (point.y - y0) * Math.sin(Utilities.toRadians(angle)));
   float y = (float) (y0 + (point.x - x0) * Math.sin(Utilities.toRadians(angle)) +
			(point.y - y0) * Math.cos(Utilities.toRadians(angle)));

   Point npoint = mPoints.get(i);
   npoint.x = x;
   npoint.y = y;
  
   mPoints.set(i, npoint);
  }
  
}

This is the update method for the object

public void update(float deltaTime) {

  mAccumulatedTime += deltaTime;

  while(mAccumulatedTime > FIXED_FRAME_TIME) {
   mAccumulatedTime -= FIXED_FRAME_TIME;
  
   if(isActive()) {
	rotate();
	mBounding.rotate(mPosition.x, mPosition.y, mDegree);
	drawBounding();
   }
  }
}

Trying to limit the time has no effect on the polygon and it continues to speed up and slow down.

Can anyone please identify the error or lead me in the right direction to fix this?

thanks

Roguelike FOV

28 February 2011 - 05:40 PM

I am fairly proficient in c++ and I am working on a project in college. I am creating a roguelike from scratch without using external libraries other than SDL. I am working on implementing field of view for the player. I have looked a several different kinds of algorithms to use but they are either in a different language or I am unable to follow what is going on. Could someone please explain how any kind of FOV algorithm works. It just needs to be simple. Ive tried using Bresenham's line algorithm but i couldnt get it to detect when something was blocking the line.

void cMap::calculateLOSBresenham(int x0, int y0, int x1, int y1)
{
		int x = 0, y = 0;

		int delta_x = x1 - x0;
		int delta_y = y1 - y0;			// slope defined

		int steps = max( abs(delta_x), abs(delta_y));
		double c = 1.0 / max(1, steps);

		for(int i = 0; i <= steps; i++) {
			x = int(x0 + (i * delta_x * c) + 0.5);
			y = int(y0 + (i * delta_y * c) + 0.5);
   		// should detect it in here but i couldnt get it to work.
		}
}

If anyone could please help me, I would appreciate it.

thanks,
Manderin87

Class/Item help

20 February 2005 - 11:31 PM

I am developing an rpg and im creating a way to keep track of items. so far im using classes to keep track of the data, but i need a way to keep it simple. i dont want it to take up more space than needed and since there are multiple item types, each type can have different variables to keep track of. I first thought just to use a Item Class that keeps track of everything, but some items are e.x weapons or armor... some items dont need weapon or armor data so its just wasted space... i tried inheiritence, but then i cant keep track of all items in a single list... anyone out there help me out? basic source

#include <iostream>
#include <fstream>
#include <bitset>


class Objectbase
{
public:
	int                             m_vID;
	CString                         m_Article;
	CString                         m_Name;
	CString                         m_Keywords;
	bitset<3>                       m_Types;

	int				m_Weight;
	int				m_Length;
	int				m_Width;
	int				m_Height;

	Objectbase(void)		{;}
	~Objectbase(void)		{;}
};

class SubObject
{
public:
	Objectbase		m_SubObject;
	SubObject		*next;

	SubObject(void);		{;}
	~SubObject(void);		{;}
};

class Object
{
public:
	Objectbase		m_Object;
	SubObject	   *m_SubObjects;
	int				numSubObjects;

	Object(void)			{;}
	~SubObject(void)		{;}
};


then i would make a class for each type of object, but i dont want to have to keep track of each item type in a seperate list. thanks

PARTNERS