I do my game and I have one problem. In my game will be skins. And player can choose them. How can I save skins(images)? How can player choose them? What do I need to do? Use JSON or SQLite?
Add Preference to your images,like you have two themes blue and red.put your images in assert blue_BG.jpg and red_BG.jpg.if user selected the blue theme.see the below code:
local selectedTheme = "blue"
local Background=display.newImage(sceneGroup,selectedTheme.."_BG.jpg",320,480)
Related
I'm developing a game in Corona SDK!
My game loads rooms individually and then places them side-by-side to make a full map. Each room is its own Display Group made with display.newGroup(). I used the opensource library ponyTiled to do most of this.
There is a minor problem though: All objects placed in the second room are put in FRONT of all the objects in the first one. That includes background, NPCs, Walls, floor tiles, etc. I tried using object:toBack() to move background tiles backwards, BUT since the rooms are separate display groups, they don't effect each other!
SO! I need to know how to combine display groups so I can use object:toBack()! How do I do that?
You can add display groups inside other display groups. For instance, sceneGroup is just a display group.
If you were to add the display groups that you want to order inside the same display group, like the sceneGroup, then you can use the group:toFront(), group:toBack(), etc. function calls.
I have a requirement to show a text on a paper when mobile device place it on the paper ,this is basically an augmented reality feature.
There will be an maker in the paper , and the app it self will recognise the marker and should place a dynamic text which receives from server . So this text will change
So as a start i decided to move with Vuforia SDK since it has more support than any other sdks available. So i managed to run there sample apps and show there "tea pot" in my own marker ,
But now comes the hardest part , that i need to render text on the marker instead of tea pot. so seems i have two options
1) Using unity create the 2d text object
2) Using openGL render text as in teapot
So my question is what is the appropriate way to do this ?? i know OpenGL is not easy to implement , even the Unity will provide multiple unnecessary files both have pros and cons
what is the best way to this ??
You get your text from server, let's say json file. Parse it and apply the result to a text mesh object or a Text object in a world canvas.
https://docs.unity3d.com/Manual/class-TextMesh.html
https://unity3d.com/fr/learn/tutorials/topics/user-interface-ui/ui-text
You can place those object in place of the tea pot under the image target or modify the DefaultTrackableEventHandler so that instead of affecting Collider and Renderer on child object it would do action on any object.
Look for the OnTrackingFound/Lost methods.
So after reading few articles i managed to put a GuiLabel on top of real world object. It was all about using WorldToScreenPoint and set it to the position
Camera cam=Camera.current;
GUIStyle textStyle = new GUIStyle ();
textStyle.fontSize = 40;
textStyle.normal.textColor = Color.yellow;
Vector3 pos=cam.WorldToScreenPoint(targetPosition);
GUI.Label(new Rect(pos.x-40,Screen.height-pos.y,250,200),"Product Price",textStyle);
So I have seen some totorials around that tell how to make a scoreboard using the Game Center API. Don't get me wrong I love the idea of Game Center, but I dont want my users to have to fuddle with logging in and I dont want to use their way of displaying scores because it does not match the style of the game.
Does anyone know of a better way to do this so I can decide how to display the scoreboard? All I want to do is tell the user his numerical rank like "rank: 1054", and then display the top 100 users (each user has their best score up). And then if I could just have an array with a string for their name, and numbers for their score. I am fine using the Game Center API as long as I dont have to use it for displaying it.
Also is their a way I could make like an "int" that is stored on Game Center that keeps track of how many times the play button has been pressed for all users? Thanks much!
I'm trying to use the Perspective Virtual Camera library, to create a game, where the player can move, the library seems to be pretty famous as a see many people referring to it, but i did not found any tutorials on how to use it. The "Camera" is working, and the man player is being followed around, but thats it.
Basically i want the Background Sky to always stay in the screen. And the mountains and threes to move. How could i do that? Is this the right tool to do the job?
This is the code to add then to the Camera:
camera:add(background, 8, false) -- SKY
camera:add(montanhas, 7, false) -- Mountains
camera:add(arvores, 6, false) -- Trees
camera:add(floor,5, false)
camera:add(hero, 1, true) - hero
The grey circles on the bottom of the image, are my HUD, i'm not adding them to the camera ( just to scene ), so they just stay in the correct position.
Thanks guys!
I don't know how to use your plugin, but it might be easier to not use it. Just create different groups with the display.newGroup() api. You would basically have one group for the foreground, and one group for the background.
You might want to try this. Instead of inserting the background into the groups set by that program, use the object:toBack() API.
I have a platform application with a series of platforms in an array and a player. Since the map is quite large, I would like to implement a minimap to keep the player from being lost/confused. What is the best way to implement this (the way with the least resource consumption)? Thank you!
If your whole level is in a big display group, you could save the image to a file, load it in and scale it down to the size of your minimap.