background preloader

Languages de prog

Facebook Twitter

Cocos2d – Part 4: Menus and Transitions. Menus OK, let’s talk menus. Because some people might have a preconceived idea of what a menu is, let’s define it in this context as a collection of visual items that can be tapped on to make a choice. This includes main menu screens of games as well as settings or options menus and even things like level choosers. Menus are very often lists of text items, but could also include icons or larger images as items. Let’s take a simple example of a main menu. It might have various options such as “Play”, “Settings”, and “About”. First let’s create the three target scenes. Here you can see we are creating, positioning and adding the background.

The settings and about scenes are nearly identical. Now, onto the menu scene. The first thing we do in init is to create a few MenuItems. Each selector simply tells the Director to replace the MenuScene with the newly chosen scene. Finally, we create the menu itself with these three items, using Menu’s menuWithItems static method. Transitions with this: How To Make A Simple iPhone Game with Cocos2D Tutorial. Ninjas Going Pew-Pew! Note from Ray: You guys voted for me to update this classic beginning Cocos2D tutorial series from Cocos2D 1.X to Cocos2D 2.X in the weekly tutorial vote, so your wish is my command! :] This tutorial series is now fully up-to-date for Cocos2D 2.X, Xcode 4.5, and has a ton of improvements such as Retina display and iPhone 4″ screen support.

Here’s the pre Cocos2D 1.X version if you need it! Cocos2D is a powerful library for the iPhone that can save you a lot of time while building your iPhone game. Back when I first started learning Cocos2D, there were several useful tutorials on getting started with Cocos2D out there, but I couldn’t find anything quite like what I was looking for – making a very simple but functional game with animation, collisions, and audio without using too many advanced features. I ended up making a simple game of my own, and thought I’d write a tutorial series based on my experience in case it might be useful to other newcomers.

Conclusion . Using Blocks in iOS 4: The Basics. iOS 4 introduces one new feature that will fundamentally change the way you program in general: blocks. Blocks are an extension to the C language and thus fully supported in Objective-C. If you're coming from a programming language such as Ruby, Python, or Lisp, then you know the power of blocks. Simply put, blocks let you encapsulate chunks of code and pass them around like any other object. It's a different style of programming that you'll want to become familiar with to take advantage of new APIs in iOS 4. Let's start by taking a look at two examples of where you might use blocks in iOS 4: view animations and enumeration. Blocks By Example As our first example, suppose we're creating a card game and we want to animate sliding a card from the dealer's hand to a player's position.

[UIView animateWithDuration:2.0 animations:^ { self.cardView.alpha = 1.0; self.cardView.frame = CGRectMake(176.0, 258.0, 72.0, 96.0); self.cardView.transform = CGAffineTransformMakeRotation(M_PI); }]; Your Turn. Salamin Nicolas. Aide-mémoire (Fourre-tout) Objective-C: Pour exécuter son application, cliquez simplement sur "run". Ah bon, ce n'est pas aussi simple??? :) Alors regardez la page des certificats. Fonctions: //Exemple1: // A mettre dans le header (fichier .h) - (void)fonctionAlaCon; // Sert à la déclarer. // A mettre dans le main (fichier .m) n'importe où. // Pour l'appeler [self fonctionAlaCon]; //Exemple2: // A mettre dans le header (fichier .h) - (int)unChiffre; // int détermine le format retourné // A mettre dans le main (fichier .m) n'importe où. // Pour l'appeler if ( [self unChiffre] == 1 ) //Exemple3: // A mettre dans le header (fichier .h) - (int)jeDoubleTout:(int)x; // Ajout du paramêtre x // A mettre dans le main (fichier .m) n'importe où. // Pour l'appeler if ( [self jeDoubleTout:(2)] == 4 ) //Exemple4: // A mettre dans le header (fichier .h) - (int)jeDoubleTout:(int)x parCeci:(int)y; // Ajout du paramêtre x // A mettre dans le main (fichier .m) n'importe où.

Variables: @end return 0; } La programmation iPhone. Dl.dropbox.com/u/4943166/Channel Documents/Tutorial List.pdf. 01: Un programme est une série d'instructions. Submitted by RoFa Moden on Mon, 03/31/2008 - 06:48. Introduction Si vous apprenez à conduire une voiture, vous devez apprendre à manier plusieurs choses en même temps. Vous devez saisir à la fois le fonctionnement des pédales d'embrayage, de l'accélérateur et des freins.

La programmation exige également d'avoir à l'esprit un grand nombre de choses, sans quoi votre programme plantera. Si l'intérieur d'une voiture vous était déjà familier avant de commencer à apprendre à conduire, vous n'aurez pas cet avantage en apprenant comment programmer avec Xcode. Afin de ne pas vous submerger, nous garderons la question de l'environnement de programmation pour un chapitre ultérieur. A l'école primaire, vous deviez faire des calculs en remplissant les pointillés: 2 + 6 = ...?... En secondaire les pointillés n'étaient plus à la mode, et des variables nommées x et y (ainsi qu'un nouveau nom sophistiqué, "algèbre") faisaient tout un foin. 2 + 6 = x? Variables Objectif-C utilise aussi des variables.

Modulo. DLFP: Sortie de Marionnet 0.90.6.