Installing Cocos2d in Xcode…

Yippee:) So Gaming is always a pleasurable thing.Cocos2d has 2 game engines namely,

  1. Box2d
  2. Chipmunk

While comparing to chipmunk,Bx2d is something added with flavour.OK…

Installing Cocos2d:

1. You can Download COCOS2D latest version from
http://www.cocos2d-iphone.org/download” this link

2. open the terminal and type “cd”

3.Drag your latest version of -> COCOS2D package folder in to your terminal window.

4. Type sudo and open the COCOS2D package folder and drag the “install-templates.sh” file into your terminal     windows and press enter.

6. put your system password to install templates.

Enjoy gaming!!!

Introduction cocos2d…

cocos2d

Cocos2d

It is a framework for building 2D games, demos, and other graphical/interactive applications. It is based on the cocos2d design: it uses the same concepts, but instead of using python it uses objective-c. cocos2d for iPhone is:

  • Easy to use: it uses a familiar API, and comes with lots of examples
  • Fast: it uses the OpenGL ES best practices and optimized data structures
  • Flexible: it is easy to extend, easy to integrate with 3rd party libraries
  • Free: is open source, compatible both with closed and open source games
  • Community supported: cocos2d has an active, big and friendly community (forum, IRC)
  • AppStore approved: More than 2500 AppStore games already use it, including many best seller games.

cocos2d for iPhone supports: iPod TouchiPhoneiPad and OS X

Features:

  • Scene management (workflow)
  • Transitions between scenes
  • Sprites and Sprite Sheets
  • Effects: Lens, Ripple, Waves, Liquid, Twirl, etc.
  • Actions (behaviors):
    • Trasformation Actions: Move, Rotate, Scale, Jump, etc.
    • Composable actions: Sequence, Spawn, Repeat, Reverse
    • Ease Actions: Exp, Sin, Cubic, etc.
    • Misc actions: CallFunc, OrbitCamera
  • Basic menus and buttons
  • Integrated physics engine (both Box2d and Chipmunk)
  • Particle system
  • Text rendering support (variable and fixed width fonts)
  • Texture Atlas support
  • Tile Map support (TMXmaps):
    • Orthogonal maps
    • Isometric maps
    • Hexagonal maps
  • Parallax scrolling support
  • Sound support
  • Streak Motion support
  • Render Texture support
  • High Score server (Cocos Live)
  • Point based API: Supports Retina Display
  • Touch/Accelerometer support (iOS).  Keyboard / Mouse support (Mac)
  • Portrait and Landscape mode (iOS) / Automatic Fullscreen support (Mac)
  • Integrated Pause/Resume
  • Fast Textures:Supports PVRTC textures, 8-bit textures, 16-bit textures and 32-bit textures
  • Language: objective-c
  • OpenGL ES 1.1 based (iOS) / OpenGL 1.5 based (Mac)

courtesy:http://www.cocos2d-iphone.org

UISlider Example…

UISlider is an visual object used to select a single value from a continuous range of values.Values can be selected by sliding.

Step 1: Drag and drop a UITextField and a UISlider in the xib.

Step 2: Set the reference for UISlider and UITextField in the .h file.UISlider as ‘slider’ and UITextField as ‘sliderTextField‘.

@property (weak, nonatomic) IBOutlet UISlider *slider;

@property (weak, nonatomic) IBOutlet UITextField *sliderTextField;

Step 3: Set an action method for UISlider as ‘sliderProgress‘.

- (IBAction)sliderProgress:(id)sender;

Step 4: Enter this code inside the method ‘sliderProgress‘.

 sliderTextField.text = [NSString stringWithFormat:@"%f",slider.value];

Step 5: We are done now,Run the Program !

Java Variable Types

 

In Java all variables must be declared before the use.basic declaration will be like,

Syntax:

‘ DataType VariableName; ‘

Example:

int a;

float b;

Continuous declaration also allowed like ‘int a,b,c;’.

There are three types of variables in java.they are,

  • Local Variable.
  • Instance Variable.
  • Class/Static Variable.

Local Variable:

  • Local variables are declared inside the method,constructor or block.
  • They are visible only inside the block in which they are declared.
  • Local variables do not have a default value so it must be declared  and initialized before the first use.
  • Access modifiers cannot be implemented for local variables.
  • Local variables are destroyed immediately after exits the block.

Example Code:

public class Age {

public void printAge()

{

int ageCount = 0;        // ageCount is a Local Variable

ageCount = ageCount + 5;

System.out.println(“Age is “+ageCount);

}

public static void main(String args[])

{

Age object1 = new Age();

object1.printAge();

}

}

Instance Variable:

  • Instance variables are declared outside the method and constructor or block.
  • Memory will be created in the heap when the instance variable is created.
  • Instance variable is created when an object is created using the ‘new’ keyword.
  • Access modifiers can be applied to these variables.but however ‘private’ is advisable.If the variables needs to be accessed by the subclasses then the visibility can be modified.
  • Instance variables have their default values.So it is not a must to declare and instantiate.Example: int a;
    Here the variable ‘a’ holds 0 as its default value.
  • Instance variables holds values that must be referenced by more than one method,constructor or block.State should be maintained throughout the class.
  • They can be directly called by their name inside the class.Subclasses have to use the qualified name.Example: ‘ObjectName.VariableName’

Example Code:

public class Employee {

public String employeeName;     // employeeName and employeeSalary are Instance Variables

public int employeeSalary;

public Employee(String name)

{

employeeName = name;

}

public void setEmployeeValues(int pay)

{

employeeSalary = pay;

System.out.println(“Employee Name is “+employeeName+” and Employee Salary is “+employeeSalary);

}

public static void main(String args[])

{

Employee employee = new Employee(“Manishankar”);

employee.setEmployeeValues(50000);

}

}

Class/Static Variable:

  • Class variables are also called as Static variables.Variables are declared with a ‘Static’ keyword outside the method,constructor or block.
  • There will be only one copy of the static variable.
  • Static variables can have access modifiers.
  • Static variables starts when the program starts and destroyed when the program stops.
  • Static variables have static memory.
  • Static variables can be accessed by calling the variable with its class name.Example: ‘ClassName.VariableName’

Example Code:

public class Test {

// Salary is a private static variable

private static int salary;

// Name is a constant variable

private static final String name = “Manishankar”;

public static void main(String args[])

{

salary = 50000;

System.out.println(“Salary is “+salary+” and Name is “+name);

}

}

Advantages and Disadvantages of Android…

Nobody thought this little Greeny Horny boy would become the competitor for mobile demons like Apple and Blackberry.This is an rapid hike.People started using this Android with lots of expectations.Android is an linux based operating system which is owned by Android.Inc.Later it was owned by Google.You dont have to be an Expert or  Scientist to give a review about this android but Anyone can who own a Android Device.I own a Android device so i thought to have this post.

Android

Advantages of Android:

Cost Effective:

make-money

The first thing about Android is its cost.People  who used to be with base level mobiles would be fed up with the boring options.But with the low price now they can go for Android phones with good design and lot of applications which is not possible with the Apple,Blackberry and some.

 

 

 

Multitasking:

multitasking

Android  has a multitasking option so you can run many applications simultaneously.As this is not a new stuff nowadays but it comes under Advantage room.

 

 

 

 

Easy Access of Store:

androidstore

So the store is in the home screen which is easy to access the applications.You dont need to settle with the fixed applications as the store is filled,filling and will be filled with plenty of applications.

 

 

UserInterface Big Screen:

BigScreen

Android breaks the word ‘More Money Big Phone’.Yes you can afford a big screen android mobile with your savings.So there is no need to close your bank account.

 

 

 

Disadvantages of Android:

Application Quality:

quality

Application Quality is not so good.There is no standard for these applications.Few application roam with the memory Leaks and Crashes

 

 

 

Battery Life:

battery

Android more wasteful than any otheroperating system, because this operating system is a lot of “process”in the background that lead to the battery quickly drains.

 

 

Virus Applications:

virusFew Android Applications contain virus also present in the Android Market.Due the lack of Quality Standard many applications contain viruses which makes your mobile hung.

 

 

Advertise:

advertise

Application in the Android phones can indeed be obtained easily and for free, but the consequences in each of these applications, will always be ads on display, either the top or bottom of the application.

Objects and Classes…

Java is an Object Oriented Language.It supports Object Oriented features like,

  • Polymorphism
  • Inheritance
  • Classes
  • Objects
  • Abstraction
  • Encapsulation
  • Overloading
  • Overriding
  • Reusability

Objects in Java:

Object Oriented concepts are implemented to match the real life entities.Object can be a man,desk,car or anything which has a

  • State
  • Identity
  • Behaviour

Classes in Java:

A class is an collection of objects which holds the properties of the objects.Its is an blue print of the objects behaviour.

Example:

A clear definition of a class would be,consider a class as a car.

  • Identity – A car has a color,number and unique body.
  • Behaviour – A car can move,move backward etc.
  • State – Car is idle,moving etc.

Creating a Class:

public Class Car

{

String carName;

int carNumber;

String carColor;

void moving();

void stop();

}

A Class can contain any number of variables,methods and objects.Here moving() and stop() are methods remaining things would fall as variables.There are types in variables we gonna have them later.

Creating an Object:

Object can hold values.It is used to match real time entities as i said earlier.Objects can be created using the ‘new’ keyword.Here the ‘new’ refers to a new memory allocation.

Object can be created in several ways.They are,

1.Declaration

2.Instantiation

3.Initialization

Declaration:

Syntax: ‘ClassName ObjectName;’

Instantiation:

Syntax: ‘ClassName ObjectName = new ClassName();’

Initialization:

Syntax: ‘ClassName ObjectName = new ClassName(“Value”);’

Struts Introduction…

Struts is a mature open source MVC(Model-View-Controller) frame work for web applications. With Struts we can easily integrate various technologies like J2EE , Hibernate, iBATIS, JSTL and JSF, Velocity Templates, XSLT etc. Apart from being a framework Struts also provides utilities and custom tags to cut down development time.

Struts is a very popular framework and has now become a de-facto standard for Java applications. The reasons for this popularity are given below

Advantages of Struts

Advantage MVC

Struts imposes the MVC framework so that no body goes off loop and does his own non standard implementation. Before Struts MVC implementations were development team’s perception of MVC which lead to lots of confusion, errors and increased the learning curve for that implementation. With Struts this human element is gone and a standard process of MVC is imposed on the developers

Advantage ConfigurationsStruts works completely on configurations in XML and property files rather than hard coding the components in the Java code. All the elements like Controller actions, redirects, validations, exceptions can be incorporated by configurations and can be easily tracked at a later stage.

Advantage Utilities

Struts provides lots of utilities derived from Apache Commons to make our life easier like ready made Form Beans for request parameters, Validation controls and Custom tags

Disadvantages of Struts

Disadvantage Performance

Frameworks mean bigger call stacks due to various function calls which results in lesser performance. However this is a performance sacrifice is offset by major advantage of standardized development process advantage.

Disadvantage Beginners

Though this is not an issue with experienced developers, the new developers have a bigger learning curve. The documentation at Apache is mostly targeted at the experienced audience.

Disadvantage Imposing

If you want to use Struts then you will have to just follow the rules set by this framework. Going in a different way is pretty tedious.

Disadvantage Small Programs

Struts is not always useful for a smaller programs because there is no point in wasting time on various Struts configurations when you can write your program in a jiffy. The program requirements should be carefully evaluated before using Struts.