[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/colliders Makefile.am,NONE,1.1 pingu_
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/colliders Makefile.am,NONE,1.1 pingu_collider.cxx,NONE,1.1 pingu_collider.hxx,NONE,1.1 |
Date: |
12 Feb 2003 22:43:40 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/colliders
In directory dark:/tmp/cvs-serv7222/colliders
Added Files:
Makefile.am pingu_collider.cxx pingu_collider.hxx
Log Message:
added mover/collider implementations
--- NEW FILE: Makefile.am ---
# Pingus - A free Lemmings clone
# Copyright (C) 1999 Ingo Ruhnke <address@hidden>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
libdir=$(prefix)/share/games/@PACKAGE@/libs
EXTRA_DIST = README
# -- Dynamic Libs --
#lib_LTLIBRARIES = libpingu_colliders.la
# -- Static Libs --
noinst_LIBRARIES = libpingus_colliders.a
libpingus_colliders_a_SOURCES = \
pingu_collider.cxx pingu_collider.hxx
# EOF #
--- NEW FILE: pingu_collider.cxx ---
// $Id: pingu_collider.cxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../pingu_action.hxx"
#include "../groundtype.hxx"
#include "../vector.hxx"
#include "pingu_collider.hxx"
namespace Colliders {
PinguCollider::PinguCollider(const bool falling_arg, const int height_arg)
: falling(falling_arg),
height(height_arg)
{
}
PinguCollider::~PinguCollider()
{
}
bool PinguCollider::operator() (World* const world, Vector pos) const
{
int pixel;
bool collided = false;
float top_of_pingu = pos.y - height;
for (; pos.y >= top_of_pingu; --pos.y)
{
pixel = getpixel(world, pos);
// If there is something in the way, then Pingu has collided with
// something. However, if not falling and colliding with a
// Bridge, allow Pingu to go through it.
if ((!falling || pixel != Groundtype::GP_BRIDGE)
&& pixel != Groundtype::GP_NOTHING)
{
collided = true;
break;
}
}
return collided;
}
} // namespace Colliders
/* EOF */
--- NEW FILE: pingu_collider.hxx ---
// $Id: pingu_collider.hxx,v 1.1 2003/02/12 22:43:38 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PINGUS_UPRIGHT_PINGU_COLLIDER_HXX
#define HEADER_PINGUS_UPRIGHT_PINGU_COLLIDER_HXX
#include "../collider.hxx"
namespace Colliders {
class PinguCollider : public Collider
{
public:
/** Constructor for abstract class */
PinguCollider(const bool falling_arg, const int height_arg);
/** Destructor for abstract class */
~PinguCollider();
/** Find out if a Pingu at the specified position is colliding with
something */
bool operator() (World* const world, Vector pos) const;
private:
/** Indicates whether a Pingu is falling or not */
bool falling;
/** Pingu could be on its belly. Therefore, this is the current height of
the Pingu. */
int height;
};
} // namespace Colliders
#endif
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/colliders Makefile.am,NONE,1.1 pingu_collider.cxx,NONE,1.1 pingu_collider.hxx,NONE,1.1,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/colliders - New directory
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/movers Makefile.am,NONE,1.1 linear_mover.cxx,NONE,1.1 linear_mover.hxx,NONE,1.1
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/colliders - New directory
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/movers Makefile.am,NONE,1.1 linear_mover.cxx,NONE,1.1 linear_mover.hxx,NONE,1.1
- Index(es):