コード例 #1
0
        public bool Collision_Detect()
        {
            Falling_Object ball = queue_Falling_obj.Peek();
            Stat_Object    box  = arr_Stat_obj[ball.pos];

            if ((box.y_coord) > (ball.y_coord + (ball.height)))
            {
                if (box.y_coord <= ball.y_coord + ball.height + 10 * ball.vel_y + 56 * ball.accln_y && box.y_coord > ball.y_coord + ball.height + 9 * ball.vel_y + 46 * ball.accln_y)
                {
                    this.Add_Rand_Falling_Obj();
                }
                return(false);
            }
            else
            {
                queue_Falling_obj.Dequeue();
                if (box.type == ball.type)
                {
                    score += 1;
                }
                else
                {
                    //score -= (arr_Stat_obj[ball.pos].mass + ball.mass);
                    //arr_Stat_obj[ball.pos].mass += ball.mass;
                }

                return(true);
            }
        }
コード例 #2
0
        public Board()
        {
            int i;

            queue_Falling_obj = new Queue <Falling_Object>();
            arr_Stat_obj      = new List <Stat_Object>();
            for (i = 0; i < 6; i++)
            {
                Stat_Object temp = new Stat_Object(i, i);
                arr_Stat_obj.Add(temp);
            }
            queue_Falling_obj.Enqueue(new Falling_Object(3, 0.25, 0.1, 1));
            score      = 0;
            difficulty = GameConstant.diff_level;
        }