]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
bird AI + xcfs
authorClyne Sullivan <tullivan99@gmail.com>
Tue, 27 Oct 2015 12:48:01 +0000 (08:48 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Tue, 27 Oct 2015 12:48:01 +0000 (08:48 -0400)
Changelog
assets/mountain.png [new file with mode: 0644]
src/entities.cpp
src/gameplay.cpp
xcf/mountain.xcf [new file with mode: 0644]

index c1426fdf5fc14a8c1286a9e8452250379c6ee405..4c4d82300a675adbf4594fe924eaf72fa6acafdb 100644 (file)
--- a/Changelog
+++ b/Changelog
        - fixed GLEW shader initialization segfault
        - began working on bird mob
        - improved world scenery
+
+10/27/2015:
+===========
+
+       - added a parallax background layer
+       - gained knowledge on sprite creation
+       - created tree and mountain sprites
+       - created a decent bird AI
diff --git a/assets/mountain.png b/assets/mountain.png
new file mode 100644 (file)
index 0000000..12c0f64
Binary files /dev/null and b/assets/mountain.png differ
index da096bc2a191ce43d9750127e7488895971be85c..0479d5e6cd855224709a62c46546bf71a04fd355 100644 (file)
@@ -332,6 +332,7 @@ unsigned int Structures::spawn(_TYPE t, float x, float y){ //spawns a structure
 
 void Mob::wander(int timeRun){
        static int direction;   //variable to decide what direction the entity moves
+       static unsigned int hey=0,hi=0;
        switch(subtype){
        case MS_RABBIT:
                if(!ticksToUse){
@@ -350,7 +351,10 @@ void Mob::wander(int timeRun){
                ticksToUse--; //removes one off of the entities timer
                break;
        case MS_BIRD:
-               if(loc.y<=init_y-.2)vel.y+=.005*deltaTime;      // TODO handle direction
+               if(loc.y<=init_y-.2)vel.y=.02*deltaTime;        // TODO handle direction
+               vel.x=.02*deltaTime;
+               if(++hey==200){hey=0;hi^=1;}
+               if(hi)vel.x*=-1;
                break;
        default:
                break;
index 1de542ddea2dbb1ea964afe88493a975983c68f7..d1cc69d175c7d0c3d4159bf09c7b1e989741f9fa 100644 (file)
@@ -84,9 +84,9 @@ void initEverything(void){
        entity.push_back(mob.back());
        mob.back()->spawn(200,100);
 
-       mob.push_back(new Mob(2));
+       mob.push_back(new Mob(MS_BIRD));
        entity.push_back(mob.back());
-       mob.back()->spawn(200,100);
+       mob.back()->spawn(-500,500);
        
        /*
         *      Link all the entities that were just created to the initial world, and setup a test AI function. 
diff --git a/xcf/mountain.xcf b/xcf/mountain.xcf
new file mode 100644 (file)
index 0000000..5ef311e
Binary files /dev/null and b/xcf/mountain.xcf differ