Questions tagged [objective-c]
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.
180 questions
0
votes
0
answers
160
views
What is the math to project a 3D object's center onto a 2D plane?
What I really need is the x,y of the object when it is outside of the screen:
I'm actually coding a UI in Objective-C, not a game.
In this different kind of UI you navigate a 3D space with objects.
...
1
vote
1
answer
119
views
Objective C Path
I am looking for some help on what would be the best approach to create a path from one point in a grid to the other side.
Imagine a grid of 5 x 5, where at (0,1) there is a light source pointing ...
1
vote
1
answer
571
views
SpriteKit and Swift or Objective-C [closed]
As a newbie to iOS programming, I'm wondering which of these would be more conducive to the type of game I want to program. I've been tasked to program an iOS game for my company. They asked me to do ...
5
votes
2
answers
2k
views
How to play sound effects on iOS?
I have a game that plays sounds when some events occur.
Currently, I am using AVAudioPlayer for the purpose of playing the sound. But just the bare ...
1
vote
0
answers
48
views
Paradigm for storing user data for iOS
Disclaimer: I'm not well versed in Game Dev best practices so this may be a trivial question.
I'm developing an iPhone game in which I have to store a user profile containing such information as ...
0
votes
2
answers
594
views
Tetris implementing rotation
I am currently at the last stage of the Tetris Clone using SDL library, the only thing left is rotation. For each piece I have a separate class, and in order to move the pieces down I use a method:
<...
2
votes
1
answer
288
views
Making Bigger Touch Space in Node Using SpriteKit And Objective-C
I am trying to make simple game, but I have a problem. The node is too small. On iPhones with smaller screen size, the finger can't move it. On iPad and on simulator, however, the node can be moved ...
1
vote
1
answer
648
views
How can I describe a square in OpenGL ES 2.0?
I need to draw a Tic-Tac-Toe board in Xcode using OpenGL ES 2.0. I am new to graphics programming and can't find good information on drawing a square in opengl es in iOS. I looked at Ray's tutorials, ...
3
votes
3
answers
2k
views
How to set up a game loop for a project targeting iOS?
I'm a fellow game programmer who's done many game engines in Game Maker 8.1, Visual Studio XNA and MonoGame with C#, and one in Java Android with Eclipse. I'm very used to C# and love it plus the VS ...
1
vote
0
answers
465
views
What is Sprite Kit capable of? [closed]
I am messing around with Game Maker in my free time. I learned some Java at school but never really understood the object oriented principles. When I got to know Game Maker I was surprised that game ...
1
vote
0
answers
85
views
SpriteKit Obj-C – How to add a force on a node a certain distance according to screen size
I have an SKSpriteNode that I'm trying to throw up to a certain point on the screen. I've tried applying an impulse and/or force according to the screen size, but that has strange results. I've also ...
3
votes
1
answer
448
views
Objective-C SpriteKit – How to make a circle of buttons [closed]
I have some code in a project already, but I'd like to change it up a bit. Currently, my code creates an empty node called _buttonLayer and then create some buttons ...
2
votes
0
answers
69
views
Field of vision - Objective-c
Here's where I'm at.
Here's where I want to be
Here's how it's drawn
...
3
votes
1
answer
372
views
How to calculate final force vector for the SKSpriteNode
I am creating space game which has an effect similar to black hole's gravitational effect. Wherever the spaceship is going, the black hole will attract it, summing up all the vectors together.
I know ...
1
vote
1
answer
214
views
How to write a custom map canvas and project coordinates on it? [closed]
I am writing a game with Objective C ( xcode ) and I need to use the users location service to mark their position on a map but since I need to create my own map component, I am not able to use the ...
0
votes
1
answer
1k
views
How to resize the child node fit inside SKSpriteNode when resizing?
I am creating a virtual gamepad for my game, It has one main SKSpriteNode with circle image and four child node(up, down, left, right) with image. When I am using default size for all it looks perfect ...
0
votes
0
answers
620
views
Moving pac-man in maze game using objective c
I am trying to develop maze game using objective-c, I want to allow moving the pac-man using swipe method, the user can swipe his fingers on the iPhone to indicate where he want PAC-MAN to go but I'm ...
1
vote
1
answer
106
views
Run some objc code very early in unity iOS game lifetime
I want to hook up a crash reporting service to my unity iOS game. It's just one line of objC to add, as early into the app lifecycle as possible, but I'm not sure how to get it to run. I know I could ...
0
votes
1
answer
185
views
Transition from UIView to CCScene in Cocos2D
I've surfed the internet for quite some time but haven't come to find an answer.
Any help would be greatly appreciated.
I am trying to perform a transition from a UIView to a CCScene
So i have a class ...
4
votes
1
answer
4k
views
Spritekit water flowing [closed]
I'm wondering if there is a way in spritekit to implement water flowing through a path?
like this water flow
Right now I'm generating the path using UIBezierPath and PaintCode
Any suggestion?
...
10
votes
2
answers
3k
views
Does SpriteKit follow the MVC pattern?
I am currently working on an iOS project called Old Frank that I have been trying to follow a MVC design pattern.
The gist of it is.
...
1
vote
3
answers
1k
views
Finding neighboring coordinates on offset tile map
I have a grid of hexagonal tiles. Every other row is slightly offset for visual reasons. Imagine a player touches any tile - I need to compare the coordinate of that tile, with any tile they touch ...
3
votes
3
answers
1k
views
How to approach 360 degree snake without having it "slide"
There's a great question here that helps me a little bit in what I want to do, and it explains it quite well:
How To Approach 360 Degree Snake
Basically, I want to have a smooth 360-degrees Snake ...
0
votes
0
answers
53
views
Reverting 2d canvas?
I'm making a multiplayer game which involves drawing lines. It's based this game: http://curvefever.com/sites/default/files/resize/remote/ef86488088c618df13b34f8b87aafd4e-1107x808.jpg. The game is ...
0
votes
1
answer
114
views
memorizing button tap code iOS game
I'm using a single view app in Xcode 6.1 for my game with Storyboards. Not unity or sprite kit. It's a small game not even 3MB. Anyways, I created un-lockable characters with a BOOLEAN.
...
0
votes
0
answers
335
views
Cocos2d v3 - addChild method make performance problems
i have currently a performance problem with the addChild method in cocos2d version 3.3. My scenario is currently that i have about ten ...
1
vote
0
answers
54
views
CCActionMoveBy doesnot working properly when the action called for many of the sprite in cocos2d
I have an issue with CCActionMoveBy when I call the movement action for many of my sprites. I need to move to a certain position and then remove it from the scene.
...
2
votes
1
answer
290
views
How can I test if an oriented rectangle contains another oriented rectangle?
I have the following situation:
To detect whether is the red rectangle is inside orange area I use this function:
...
1
vote
1
answer
457
views
Scrolling effect after touch
i'm making map for a game and need to make scrolling of map, so the main thing what i need is to calculate speed and move layer after player remove finger from screen.
I make it my own, but i think ...
0
votes
1
answer
347
views
Understanding CGPoints in SpriteKit
I am planning to place three cards on a view which I add to the background. However I wanted to combine two of the cards and replace the first card position with the new card position. Is there any ...
1
vote
1
answer
831
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 ...
2
votes
1
answer
477
views
SneakyInput joystick touch event ends when CCButton is pressed
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 ...
-2
votes
1
answer
421
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, ...
1
vote
1
answer
465
views
applyAngularVelocity causes error when called right after object instantiation
I'm trying to make a physicsBody rotate as soon as it is instantiated.
...
0
votes
1
answer
156
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 ...
0
votes
1
answer
891
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 ...
2
votes
1
answer
1k
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
1
answer
907
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 ...
0
votes
1
answer
757
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 ...
1
vote
1
answer
1k
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
2
answers
133
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
1
answer
484
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:
...
0
votes
1
answer
806
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 ...
-4
votes
1
answer
174
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
1
answer
873
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
1
answer
545
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 ...
2
votes
0
answers
71
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 ...
2
votes
2
answers
225
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 ...
2
votes
1
answer
578
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 ...
1
vote
1
answer
187
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 ...