Objective-C is a general-purpose, high-level, object-oriented programming language. It's mainly used for game development on Apple iOS and Mac OS devices, however it's not limitied to this platforms.
0
votes
1answer
22 views
How should I structure my code to add enemies?
So I am currently making a 1942-style game in Sprite Kit. I've reached the point where I am finished implementing pretty much everything (movement, shooting (also recognizing a hit and exploding an ...
0
votes
0answers
18 views
Video cutscene on Mac using QTKit?
My game needs to display a video file. The game engine I am using allows extensions via .dynlib files (MacOS dynamic libraries).
I changed my source's extension to .mm so I can use QTKit, but it ...
0
votes
0answers
5 views
cocos2d + sneakyinput joystick multitouch problem
I've added a joystick to my iOS game using the latest SneakyInput joystick code for cocos2d v3. It works well, but when a CCButton I have is pressed, the joystick touch event ends.
Based on my ...
0
votes
0answers
5 views
How to make the keyboard appearing for the CCTextField static?
I'm developing a typing game and I need the keyboard all the time. I've tried becomeFirstResponder for the text field inside it but it still disappears everytime.
0
votes
0answers
12 views
CCTextField won't appear
I can't seem to add a CCTextField in my physics node, I tried all different methods, but it's still not happening.
Here's my code:
CCTextField *tf = [[CCTextField alloc] init];
tf.contentSize = ...
0
votes
0answers
35 views
Error running an Action in Cocos2d-x
In my game I have a "rocket" type and I want to run a sequence of actions on it. At first it must run an explosion animation and then remove itself from the game. For this I used the following code, ...
0
votes
1answer
227 views
Changing location after CommitAnimations
I'm using the following code to move a UIImageView:
shootImg.image = [UIImage imageNamed:@"Projectile Left 1.png"];
[UIView beginAnimations:nil context:nil];
shootImg.center = ...
0
votes
0answers
19 views
How can i get latency when using Game Center?
I'm pretty new to network programming. Basically I'm using game center for making a relatively simple iPhone game using Game-center p2p. However i'm now working on a algorithm to improve the ...
0
votes
0answers
25 views
How can I fix latency problems for car game? [duplicate]
Basically I'm trying to make a online car racing game for IOS using Game Center real time multiplayer. I have setup a timer that sends data every 0.02 seconds to the other player with the current ...
0
votes
0answers
31 views
Cocos2dx InApp Purchase for ios
I am trying to integrate In App Purchases in my app made by using cocos2d x c++. I am using easyNdk Helper for In App Purchases. My In App Purchases works perfectly for my Objective C apps. But for ...
1
vote
1answer
54 views
applyAngularVelocity causes error when called right after object instantiation
I'm trying to make a physicsBody rotate as soon as it is instantiated.
CCNode* ball = [CCBReader load:@"Ball"];
[ball.physicsBody applyForce:force];
[ball.physicsBody ...
1
vote
1answer
41 views
Manually remove inactive CCParticleSystem from scene?
When using particle systems that have a lifetime, with CCParticleSystem and its derived classes, should I manually remove the finished systems from their parent nodes once the particle animations are ...
0
votes
1answer
74 views
I need some help with stopping individual sound effects in OALSimpleAudio
I'm trying to find out how to stop a specific sound effect rather than having to stop all of them.
I'm using OALSimpleAudio.
I can't seem to find how to do it. simple google searches result in ...
0
votes
0answers
31 views
How to calculate positions and randoms in scene. SpriteKit [duplicate]
So here is a code :
static inline CGFloat randomInRange(CGFloat low, CGFloat high) {
CGFloat value = arc4random_uniform(UINT32_MAX) / (CGFloat)UINT32_MAX;
return value * (high - low) +low;
}
...
1
vote
1answer
146 views
Spritebuilder and CCScrollView, page indicators not showing up?
I'm using Spritebuilder to make my game, and CCScrollView usually saves me quite a bit of time. I'm trying to implement the scroll view much in the same way as the home screen on an iphone uses the ...
5
votes
1answer
120 views
How can I implement Objective-C libraries in Unity?
I've been a "hardcore" developer for sometime now, as I've always worked with pure code reactive rendering, and contributed to Cocos2d library some time ago , (It is the one I used for my games) . But ...
0
votes
1answer
113 views
Incorrect sprite rotation with atan2() [duplicate]
I want to rotate a sprite so that it faces the mouse cursor/screen touch location. Currently I'm using the following method to compute the angle of rotation. The input position is the target point the ...
0
votes
2answers
43 views
Count number of CCNodes of a certain class on a layer
Pretty simple question. I'm working in Objective C (cocos2d) and I'm trying to count the number of a sprites of a certain class are present on the current layer being displayed. For example, I have a ...
0
votes
1answer
275 views
Preload in cocos2d v3
I'm trying to create a preload, but i don't know how to implement the code of this topic in cocos2d iphone v3. Since CCTextureCache has changed to CCTexture, and doesn't have sharedTextureCache ...
0
votes
1answer
89 views
try to create CCSpriteFrame but get nil values
I'm trying to animate a CCSprite in cocos2d v3 following this question, but I'm getting the following error message in Log:
Terminating app due to uncaught exception 'NSInvalidArgumentException', ...
0
votes
1answer
79 views
Box2d stopping the movement of an object
I am in the process of making a game and I need an object to move only when the buttons are pressed. I have a method that begins the movement, and so far I am ending the movement of an object by ...
1
vote
0answers
59 views
How can i stack up tiles for Connect4 objective C? [closed]
I am trying to learn Objective C and iOS programming. And I'm trying to build a Connect Four. So Far i got this.
I've been looking around and asking around but I haven't got the answer to my ...
-4
votes
1answer
93 views
How can I develop a game for iOS? [closed]
I have a Mac arriving in the next few weeks, and plan to program a 2d game. I know a little bit of Java but nothing about Objective C. I've heard about cocos2d -- it seems good but I don't know ...
0
votes
1answer
402 views
Tower defense endless levels logic sprite kit [closed]
I am making a tower defense game for iOS using Sprite Kit. I would like for my game to support an endless number of levels, like in Bloons TD 5. What approach should I take to implement this?
0
votes
1answer
142 views
Help with concrete examples of Perlin Noise variables for terrain generation
I believe this question can help beginner game developers. I've looked through a dozen or so answers on perlin noise here and on Stackoverflow, and found only 1 concrete implementation of perlin noise ...
1
vote
1answer
137 views
How to centralize stat/feat/equipment related changes in an RPG?
I have a game with an RPG system where derived stats, like HP,armor, etc depend on a variety of components: armor, stats and feats. I'm running into an issue where the code to change derived metrics ...
2
votes
0answers
35 views
How to implement a property with a base value and a changed value? [duplicate]
I have a number of stats and effects in game that are subject to change, they have some kind of base value and the current value. For stats, I implemented this in a dynamic way, but for less important ...
1
vote
2answers
132 views
Architecture - how to refer to skills/abilities internally within code?
I have about 60 skills within my game, which are loaded from a JSON file. Each skill is a subclass of a skill object and has attributes like range, cost, target type, etc. Currently each skill has an ...
5
votes
1answer
826 views
OpenGL blending (masking)
I need some help with OpenGL textures masking. I have it working but need to find some other blending function parameters to work in other way.
Now I have:
//Background
...code...
...
1
vote
1answer
94 views
Where can I find info on grid based algorithms for stateless AI? [closed]
There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once.
For my testing purposes, I'm creating a "typical stateless AI", as described in ...
0
votes
1answer
61 views
Create body on a sprite (box2D)
I'm quite experimented in objective C, but now i'm tried cocos2D and his features.
I need to add a body on a spritesheet (if possible on a classic 'UIImageView'), in order to detect collisions after.
...
2
votes
2answers
1k views
Detecting right/left collisions with a bounding box
I'm building a platformer in cocos2d, my first game project. I'm working on movement and collision detection. I'm using a tilemap with a "meta" layer of invisible blocks that are designated ...
2
votes
2answers
180 views
How do I make an equipped item affect the equipper?
I'm making a small text-based adventure in Objective-C. I have a Player class with four properties which represent the player's attributes (strength, agility, stamina, and intelligence). I also have a ...
4
votes
1answer
2k views
How to make a iOS plugin for Unity3d
I've passed last 2 days reading articles and book for understand how can i make a plugin for iOS in Unity. Basically i need just a demo for understand how it work. For now i've tried to make this ...
0
votes
1answer
257 views
cocos2d collision detection between two ccsprites i am using boundingBox but this method is not working [closed]
I am making a cocos2d side scroller and I am currently putting collision detection in. I have an enemy that shoots at the player. I want to have the bullets disappear when they hit the player. The ...
0
votes
1answer
335 views
Cocos2d how to correctly preload a spritesheet before the scene start?
I'm working on a game with Objective-C and Cocos2d, the game has a huge number of images, and obviously as I add images on the spritesheet (well yes I'm using spritesheets) the loading time get ...
1
vote
1answer
476 views
Store and create game objects at positions along terrain
I have a circular character that rolls down terrain like that shown in the picture below.
The terrain is created from an array holding 1000 points. The ground is drawn one screen width infront and ...
1
vote
1answer
289 views
Mixing Objective-C and C++: Game Loop Parts
I'm trying to write all of my game in C++ except for drawing and game loop timing. Those parts are going to be in Objective-C for iOS.
Right now, I have ViewController handling the update cycle, but ...
3
votes
3answers
8k views
Can Xcode be used to create very simple games?
I am brand new to Xcode, and I am also brand new Objective-C programmer.
I was wondering if it is possible to create simple Mac games with Xcode. If it's not possible, could you recommend me some ...
1
vote
1answer
105 views
Designing a four-directional movement control
I'm developing an RPG for iOS. Currently, I plan my controls to look like this:
So the user can interact with objects, people, etc. by tapping on the right side of the screen, and moves by swiping ...
6
votes
3answers
1k views
top down game - checking, drawing enemy's line of sight area with obstacles
Examples of what i'm going to need:
I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone.
How would i test if the player is within that cone, taking obstacles ...
1
vote
0answers
200 views
Image Texture Tracing Algorithm - Cocos2D Box2D
Context: I am working on a 2D Destructible Terrain engine for Cocos2D with Box2D. All images, when a level loads, have their border's traced and cached for the purposes of forming Box2D b2EdgeShape ...
5
votes
1answer
202 views
How can I implement a “Nyan Cat” rainbow?
I'm currently making a game similar to this Nyan Cat flash game, although I'm using cocos2d. I'm having a hard time trying to make the rainbow effect:
Currently, every update call I add a piece of ...
1
vote
1answer
709 views
2D Destructible Terrain with Box2D / Cocos2D -> Image Tracing
Bear with me as this will be a rather lengthy post. For the last month I have been working on an open source Cocos2D, Box2D Destructible Terrain Engine. I have some questions regarding its ...
1
vote
1answer
133 views
Determining explosion radius damage - Circle to Rectangle 2D
One of the Cocos2D games I am working on has circular explosion effects. These explosion effects need to deal a percentage of their set maximum damage to all game characters (represented by ...
1
vote
0answers
223 views
Objective-C Moving UIView along a curved path
I'm not sure if I am approaching this the correct way. In my app, when a user touches the screen I capture the point and create an arc from a fixed point to that touch point. I then want to move a ...
3
votes
1answer
200 views
Rotate an image and get back to its original position - opengles glkit
I need to rotate an image in opengles GLkit and get it back to its original position in GLkit.
rotation += 5;
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(5), 1, 0, ...
0
votes
2answers
137 views
Cocos2d sprite's parent not reflecting true scale value
I am encountering issues with determining a CCSprite's parent node's scale value.
In my game I have a class that extends CCLayer and scales itself based on game triggers. Certain child sprites of ...
6
votes
1answer
232 views
Best way to determine surface normal for a group of pixels?
One of my current endeavors is creating a 2D destructible terrain engine for iOS Cocos2D (See https://github.com/crebstar/PWNDestructibleTerrain ). It is in an infant stages no doubt, but I have made ...
0
votes
1answer
129 views
How to store NPC movement data?
In my 2D tile-based game, I have NPCs that move around on a fixed path. I am putting the information about the NPCs in a .plist file that is loaded on startup. The thing is, I'm not sure how to format ...