Giter Site home page Giter Site logo

horseshoe7 / ccgamecameranode Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 18.9 MB

An attempt at a way to pan around your game world, which also allows zooming. For Cocos2D and SpriteBuilder 3.3

License: MIT License

Objective-C 72.43% C 11.38% CSS 0.69% C++ 2.15% Mercury 0.20% M 12.22% Shell 0.05% Python 0.52% Perl 0.15% Objective-C++ 0.07% Java 0.07% MATLAB 0.07%

ccgamecameranode's Introduction

CCGameCameraNode

An attempt at a way to pan around your game world, which also allows zooming. For Cocos2D and SpriteBuilder 3.3

Installation Instructions

  • Download and install SpriteBuilder from the Mac App Store.
  • Open the Project in SpriteBuilder and build / export it.
  • Open it in Xcode

What is this?

Sometimes you may have a game world that needs to do more than a CCFollowNode action can offer. Why? Because often you would like have zooming on your map. This CCGameCameraNode attempts to be a sort of "view manager" for your game world.

What Does the Project Currently Do?

It loads a test scene and allows you to pan and pinch the screen to adjust the zoom. There are two buttons to show off the camera animation feature of the camera. T-R for top right, B-L for bottom left. Have a look at these action handlers for an example of how to best use it.

Features

  • Adjust camera position and zoom. Convenience method allows you to zoom to a specific rectangle on your board
  • Use CCActions on the camera.

Notes

If you are using a CCPhysicsNode in your scene, make sure it is a child of the node you provide to the camera, otherwise asserts will fire when you try to zoom with the camera.

Future Work

  • Allow for rotation

Known Issues

  • I'm still familiarizing myself with Cocos2D and contentSizeType and so on. This worked fine on iPhone, but I had troubles with world boundaries for some reason on iPad. If someone knows the answer given this project, please let me know!!

What this isn't for

Endless scrollers. Not really in scope. Look somewhere else if that's what you're working on.

Legal

Do whatever you want with it, just keep your lawyers away from me. :D I think that's called MIT. I'm too busy being creative.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.