What is the right way to design a point and click game with Lua?(Corona) - lua

I have some ideas,I have already drawn the scenes roughly and put them into corona.
This is how I would think it would work.
1.I have all the major scenes
2.In each major scene ,there are mini scenes,which lead to smaller scenes with puzzles.
3.I create a game.lua module so it would handle the game logics,and keep track of them.
Example:
A.Door is opened,puzzle number one is solved.
B.Send a costume event to the game module.
4.I need a separate module for inventory box so it acts as an overlay over other scenes.
It also interacts with game module.
.
I know you might say,wait till you get started,but Am I on the right Track?
Do you have better suggestions or know any code examples(Corona Sdk,Lua,Moai,GiderosMobile)?
.
Thanks in advance

I am making a game more or less on this style using Corona, there are a beta on google play.
Corona SDK offers a API named Storyboard, that API allow you to code each scene as a lua module, and allows also you to load a scene as a "overlay".
I guess that you would make each of your scenes a full Storyboard scene, and the inventory a "overlay" scene.
The difference between overlay to a normal scene, is that when you load a overlay it triggers a event on the scene that was open instead of unloading that scene (And when the overlay is unloaded, it triggers another event)
So yes, at least if you do it in Corona, you are in the right track!

Related

Is there a way to layout my entire level in an .sks file, but only load whats currently in view?

I've seen this concept mentioned around the internet but can't find any specifics on how to do it.
I want to lay out my entire level in an .sks file but load only whats in the view of the player/frame at any given moment. In my game I have platforms that go up and down forever, simple roving enemies, and collectable coins that float in the air while bobbing up and down. Since these actions are using
SKAction.repeatForever
They are continuously going even when not in view of player. The only other option I see is giving every action a "key" and then placing invisible sprites through out the level that when contacted start and stop certain actions. While doable it seems it could get very convoluted very fast.
Is there a more straightforward way to lay out my entire scene, but only load what's currently in view? I'm not sure what to call this concept which is probably the reason I can't find much on it.
Any insight is appreciated!
There is no easy way to do it. My personal method is to load your SKS into an SKScene that is not attached to the root node at all (the SKView) and use SKCameraNode's containedNodeSet to move all nodes from the loaded scene over to the scene that is viewable to the user. You would then need to implement methods to continuously swap between the two scenes.
If your concern is only actions, then you can avoid the swapping and just pause all nodes not in the containedNodeSet and unease the ones that are inside of it.

Animating a "character" within iOS app that's not SpriteKit

I am in talks with a client to do an app, but in it, they are wanting it to revolve around a little character that follows you throughout the app (think Clippy, from the old days of Microsoft Word :)).
One thought I had was, can I use an SKSprite/Node inside an iOS app not using the SpriteKit framework?
Or is this a matter of animating through an array of UIImages?
Those were my first thoughts - does anyone know the best direction to go in for something like this? I need basic animations for a character throughout the whole app.
Depending on the detail of animation needed, you could do it with just CoreAnimation and possibly selectively choosing the image to display in an UIImageView. For example, see the answers to this question: rotate a UIView around its center but several times
Simple answer is, No, out of the box you can't use a class from a framework and choose to not use the framework. Though I'm not exactly sure what that question means. An SKSpriteNode renders via an SKScene node, and an SKScene node renders via an SKView, which is rendered by a View Controller.
You could do something fancy like dedicate the SKView as only part of the screen, and have a standard UIKit view as the other part, or only have the SKView appear on the screen when you needed it I guess.

Hybrid application with iphone?

I want to create a simple game, and as I understand it OpenGL will make that happen but could I make the menu, high score list and every thing except the game with regular xcode?
For instance, for Windows Phone (where im comming from) you could create XAML/DirectX where you totally could make the menu in xaml/cs and then the game in directx
Yes, the main view element in iOS is called an UIView and you use it to present openGL content on it. This results in being able to overlay it with any other views, subviews, put it in a superview, have multiple views with openGL content... All the events such as touches work as well. In summery implementing openGL in iOS UIView will simply override the visual content of the view leaving rest of the functionality as it is.

iOS7 SpriteKit how to implement text-heavy HUD elements?

I'm building a SpriteKit based game and would like to have a heads up display to show various unit statistics (Example below on left). A user taps on a unit and can bring up a panel that hovers over the screen and is relevant to the current unit. The user can dismiss the panel at any time and go back to gameplay.
I've looked at the sprite kit programming guide, and see that it is limited to a one line label nodes that are built in Sprite Kit. I'm also aware of this answer on adding a UITextField within didMoveToView:
However, reading the documentation it appears that didMoveToView: gets called once the scene loads. I've also seen that scene transitions are possible, but the panel that I'm thinking of does not require a full screen transition.
How would I implement a HUD panel like below using UIView and SpriteKit elements in iOS? Are there any open source projects that can give me a head start on this task?
Simply make a UIKit app as you would normally.
The SpriteKit SKView and the SKScene you present within should be just one of your views in the hierarchy.
I think in SpriteKit really should just implement actual game scenes, all the menu / overlaying HUD can be done in UIKit. That is what it stands for.

Corona SDK - Managing Game State/Objects/Inventory System/Sprite Animation

I am attempting to determine the best way and most efficient way to handle the following tasks in a game written with the Corona SDK. It seems like there are so many ways to do things that it becomes quite confusing, so I am hoping someone here can help!
I am creating an adventure type game that will have an inventory system/puzzles etc. The thought process I've developed so far involves using separate "classes" to handle each specific aspect of the game. Such as InventoryManagement.lua, ObjectManagement.lua, PuzzleManagement.lua etc.
Just a side note - this game really doesn't involve Physics, but I would like to have static images with animations that occurs (Think opening a door or picking up an object):
Here is an example of what I am trying to accomplish:
Say you start a new game and it loads the first scene. I need to setup the player's inventory, the objects in the room, their state, images for these things etc. which I assume could be defaulted on first game load, and loaded subsequently ...
Then the player clicks on a key to pick it up - at this point the key needs to appear in their inventory so now it will be removed from the scene, added to their inventory (Via InventoryManagement?), and the scene will be updated (Via SceneManagement?)...
From now on the key should no longer show in the scene.
Now say they click the key and use it on a door, the door should animate open and remain open from now on.
If the player leaves the room and comes back, the key should not appear.
Now to me it makes sense to load/unload the scene every time you enter/leave the scene, but ... won't this become memory intensive etc. if you do it this way? ... Is there a better way to handle a scene if it has say, 30 objects on screen?
Hopefully that is clear - It is hard to find specific information related to each one of these elements. Everything seems to be related to physics games and I can't seem to find something on how to "Add a key to the scene if, but not if, and if it's been used then animate that door" :(
Thanks!
Had the same problem with unexpected results when jumping between storyboards. One thing I found out was
Always make sure to Runtime:remove and stop the timers you use. One alternative when you want to reset everything is to make a reset.lua file and on enterScene you use storyboard.removeScene or storyboard.purgeScene (If you just want to get rid of all display objects you have rigged up in memory in scene:createScene).
Also check out storyboard.RemoveAll() or purgeAll()
You need to make some stuff in Global space (using _G) to use them between scenes.
To change between scenes, "Storyboard" is very nice.
But mind you, you will need to use some manual memory hacking if you make things too much memory intensive, mainly, you might need to before loading a scene, do several calls of "collectgarbage" after cleaning the last scene, otherwise you will hit a curious problem:
You loaded scene "A".
You switch to scene "B".
The game 'unloads' "A", but the garbage collector don't, then loads "B", the end result is memory use of "A" + "B".
On this adventure game I was making in Corona, it resulted in several crazy crashed until I figured the "collectgarbage" trick.

Resources