Sunday 16 June 2013

How to determine Whether the frame Contains Object or not?


Hi Team,

I have Started a simple puzzle application.

Reference Link: http://www.dailyfreegames.com/flash/puzzle-games/priests-n-devils-game.html
Totally we have  6 members (3 persons, 3 devils);

Initially am selecting one person and one devil,  and moving in to other side i'll drop one devil and come back to the person with previous positions.

This process has been repeated until to reach all the members into Other Side

One issue raises here,

When Am implementing the winning case,

If the person is in boat at some particular position, let us consider CGRectMake(10,10,50,50) in this position object has been added.

now am selecting the another person or devil, the object has been added in to the same positon .


Now I want to restrict here, If the object exists in particular position then other object has been added in to another frame but not the first frame.

In this way am implementing all the cases..

If any one have an idea, please help me out


    raft1 = CGRectMake(65, 40, 26, 50);
    raft2 = CGRectMake(116, 40, 26, 50);



   if (sourceBtn.tag==0)
        {
            if (click == firstClick)
            {
                if(boatIsLeft == YES)
                {
                    tag = king1.tag+1;
                    [king1 setTag:tag];
                    [king1 setFrame:raft1];
                    [boatView addSubview:king1];
                    [boatView bringSubviewToFront:king1];
                }
                else if (boatIsLeft == NO)
                {
                    [king1 setFrame:dest1];
                    [kingDestView addSu

bview:king1];
                }
                NSLog(@"tag value is %d", sender.tag);
                click ++;
            }
            else if (click == secondClick)
            {
                if(boatIsLeft == YES)
                {
                    tag = king1.tag+1;
                    [king1 setTag:tag];
                    [king1 setFrame:raft2];
                    [boatView addSubview:king1];
                    [boatView bringSubviewToFront:king1];
                }
                else if (boatIsLeft == NO)
                {
                    [king1 setFrame:dest1];
                    [kingDestView addSubview:king1];
                }
                click = one;
                NSLog(@"tag value is %d", sender.tag);
            }
        }



No comments:

Post a Comment