aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 0e0b8aa..ee2c33a 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -314,7 +314,10 @@ update( Player *p, unsigned int delta )
e->loc.y += e->vel.y * delta;
// dont let structures move?
- if ( e->type != STRUCTURET && e->canMove ) {
+ if ( e->type == STRUCTURET )
+ e->canMove = true;
+
+ if ( e->canMove ) {
e->loc.x += e->vel.x * delta;
// update boolean directions
@@ -823,15 +826,11 @@ singleDetect( Entity *e )
*/
if(e->loc.x < worldStart){ // Left bound
-
e->vel.x=0;
e->loc.x=(float)worldStart + HLINE / 2;
-
}else if(e->loc.x + e->width + HLINE > worldStart + worldStart * -2){ // Right bound
-
e->vel.x=0;
e->loc.x=worldStart + worldStart * -2 - e->width - HLINE;
-
}
}
}
@@ -1027,6 +1026,24 @@ goWorldLeft( Player *p )
return this;
}
+bool World::
+goWorldLeft( NPC *e )
+{
+ // check if entity is at world edge
+ if( !toLeft.empty() && e->loc.x < worldStart + HLINE * 15.0f ) {
+
+ currentWorldToLeft->addNPC(e->loc.x,e->loc.y);
+ e->alive = false;
+
+ currentWorldToLeft->npc.back()->loc.x = 0;
+ currentWorldToLeft->npc.back()->loc.y = GROUND_HEIGHT_MAXIMUM;
+
+ return true;
+ }
+
+ return false;
+}
+
World *World::
goWorldRight( Player *p )
{
@@ -1421,6 +1438,8 @@ World *loadWorldFromPtr( World *ptr )
currentWorldToRight = loadWorldFromXML( tmp->toRight );
loadedRight = false;
+ std::cout<<tmp->npc.back()->name<<std::endl;
+
return tmp;
}