I am developing an endless horizontal scrolling iPhone-game using cocos2d and box2d.
My hero has to jump over obstacles (kinematic box2d bodys) which are added on the same layer as my hero-sprite.
My problem is the different speed of the parallaxe background and the obstacles. It dosent look like they are connected. I cant find an solution to solve this problem.
I have tried to find the same speed ... but no luck.
The bet would be to add the obstacles as child to the parallaxe layer but it dosent work.
Thank you
sultan (sorry for the bad english)
Create one separate CCLayer class for moving object with box2D and add that layer to your parallaxlayer.
Here is one of my cocos2D, parallax based game: SUBVERSION SOURCE LINK
Related
I am using SpriteBuilder with Cocos2d v3.4
I need to detect touch on sprite ignoring touch in transparent place of CCSprite's bounding box.
I found few solutions (Physics Body, CGPath), but actually detecting transparent pixel seems the best solution.
I tried to use THIS but it is very old solution and not working anymore.
Could someone help me how to achieve this?
Try to create 2 CGRect on the sprite and detect touch only on these rects
i am unable to show road effect in cocos2D based game and also little bit confused about image. what type of image i have to use to show effect and how i can use this image in code to generate moving road effect.
Actually You need to move the background back in different layers or you can use parrallax node .
Here is a link for the by source code steffen ittereheim which describes in detail the process
I am pretty new to making games, but I am pretty familiar with programing iOS. I am creating a shape matching game, so there would be an array of different shapes and the user would drag the shape to the correct corresponding shape if they get it right it would stay and if they get it wrong it would shoot back. Now my question is would that be easier using cocso2d or any game engine or would it be just as easy not using one, just using a touch event?
Since the game you are describing is not graphically intense - I would recommend using UIKit. Couple of reasons why I would use UIKit over cocos2d:
Interface builder / Storyboards are awesome. You can lay out your
screens and game elements on screen. (I know tools exist to do this
using cocos like CocosBuilder, but IMO they just don't compare to
working directly in XCode)
UIKit animations couldn't be easier and you can do some pretty powerful things with minimal code.
You have direct access elements such as UITableView, UICollectionView, UIScrollView, etc. There are cocos nodes that mimic these, but they don't match up in terms of response and behavior.
For more graphically intense games I would still use cocos2d hands down. Some scenarios when you would use it:
You have a large number of sprites with a large number of animations (opengl is fast)
You want to use opengl based effects like particles, lighting, etc.
You need a physics engine
You want to work off a prebuilt game engine (there are tons such as levelsvg, kobold2d, line starter kit, etc)
Hope this helps you.
I try to use the great particle emitter which Michael Daley build for his Particle Designer to be working inside a GLKView. I see two ways to get there:
hack the code from his great (but too old) tutorial to work with iOS5.1 inside a GLKView
pay and use his Particle Designer to add the particle effect to a glkview
I tried 1. the whole day but ended alone and lost in the wide lands of openGL. I don't know how or what is important to initialize from the GL-stuff.
I ported the classes Image, Texture2D, Common and ParticleEmitter and instantiated them inside a GLKViewController, ending with an EXC_BAD_ACCESS in line 341 of ParticleEmitter.m:
// Now that all of the VBOs have been used to configure the vertices, pointer size and color
// use glDrawArrays to draw the points
glDrawArrays(GL_POINTS, 0, particleIndex);
and I don't know why or what....
Now I think about buying the Particle Designer and try to implement it inside the GLKViewController and its GLKView.
Is there any body who could help me with 1./2. to solve my problem, adding an openGL particle emitter to a view based application?
thanx!
edit: removed some stupid code
Looks like this one could help a lot...
;-)
I also created a new question here.
Hi i'm thinking about making midi step sequencer and I need to make a note grid/matrix that resizes/ adapts when you zoom. I've been searching for different ways of doing this but cant figure out a way that works well.
I thought about drawing cell objects made with (NSRect) but I couldn't figure out how to get the right interaction when resizing.
This is my first "biggish" OBJ-c project so please don't kill me, im still battling with the frameworks and the syntax is so foreign to me.
You could use Core Animation layers to create your grid.
Take a look at Apple's Geek Game Board sample code project:
http://developer.apple.com/library/mac/#samplecode/GeekGameBoard/Introduction/Intro.html
The code shows a way to display different kinds of card/board games using CALayer.
The Checkers game looks to be the closest to the grid you want to create.