I have currently built my sprites in SpriteHelper and levels in LevelHelper. I have included most of my sprites in the Level but i want to also add some separately in the code. This is so i can spawn at different rates and times based on the users progress and collections of other objects.
Can someone help me or point me in the right direction on how to include a sprite from SpriteHelper (with physics) into my code. Do i need to generate the SpriteHelper code and include it in, even though i have already included the LevelHelper generated code?
Thanks
you can create lhsprite using levelehelperloader object manually at run time. see the link below http://www.gamedevhelper.com/documentation/documentation.html#top
In levelhelper documentation search for createsprite you will get enough information to create new sprite.
Related
I am trying to make a simple QT android app, but basically my problem is that on my main screen I have about 250 little images that i want to scroll. But I really need the scrolling to be fluent and fast. First I tried it using QML but it wasnt really fast, then I tried to make the app in qt designer and use widgets but that was very slow. Then I tried using openGL but on android I can only use openGL ES and I cant find so much examples because every example that I find is much more advanced than I need.
But basically my main question is, what do you think is the best way to solve my problem and if its openGL which way of using it is the best that could solve it?
Thank you.
Neither approach should have problems when scrolling when compared to a native application on the same device. Check the following:
Make sure to measure performance only in release-builds, with QML debugging disabled and no debugger attached.
Maybe your device simply can't keep up with so many images in one view - then it's not a Qt problem. Compare with a 'native' java-App to see if this is the case.
Check if you implemented everything correctly; e.g. check if theres anything running in your main-loop or some events happenening repeatedly which consumes CPU time
And some more general advice:
Downscale your images to the appropriate view-size before giving them to the UI, as they might have to be re-scaled on every frame-update and/or consume graphics memory otherwise. E.g. dont set the source to a 1024x1024 image when it's going to show in a 64x64 view
Remove transparency from the images if they are going to display on solid-colored background anyway.
Dont overlay the images with other widgets/controls
If you're still getting a 'slow' UI, maybe try to merge all or multiple images and their surrounding UI/Controls into one or more bigger images
Very long views are not user-friendly. Maybe implement a pager or tab-view etc. to divide your list into multiple views. This way you can also decrease load-time
Dont try to implement an interface in openGL yourself. It's unlikely you'll make a better one than you already get with QtWidgets and QtQuick.
I'm searching for docs on cocos2dx website and on google but i couldn't find any. The problem is, when I load a csb file from cocostudio, it loads all the nodes and its resources etc... it makes the texture memory so high. I would like to know if there is a method or solution for loading only selected nodes from a scene file of cocostudio.
thanks!
I had the same kind of problem, and it stems from trying to make one scene contain everything you need. I decided to split my components into layers, which are then loaded by their own components when needed.
As an example. In my Main Scene I have an inventory tray, a building area and a custom buttons panel. I split all of these into separate layers. InventoryTray.csb, BuildingArea.csb, ButtonPanel.csb and have them all seperate in code as well, one object to load each of the layouts. Overall my code is a lot more maintainable since each class just has a few lines of code in it.
This way I can load my inventory tray up, and not load my buttons panel until the user "needs" to interact with it. The same goes for fancy pause menu's that might include animations and assets that may take up more texture memory. Create it as a separate layer and load it when you need to.
I hope this helps, I never found the cocostudio scenes useful, for anything other than my menu system, since each of the menu scenes that I've built (so far) has been self-contained.
You can try get a component of the .csb:
auto node = CSLoader::createNode("MainScene/MainScene.csb");
node->getComponent("Star_GameButton")->setEnabled(false);
You need the name of your component ,that is on the porperties on cocos Studio
I am starter in cocos2d-x.I have multiple sprites of arms legs eyes etc.i want to create a single sprite ,suppose a human out of it who has arms,legs,eyes,head,body etc.How to do it..As i have to animate them and make the human walking and also i have to kill it on touch.Any one here please tell me the logic in cocos2d-x using c++
CocosBuilder can be used for assembling the body parts. By laying down each sprite to its own layer, you can also animate them, create different animations for walking, dying.
Tutorials :
http://www.raywenderlich.com/23996/introduction-to-cocosbuilder
http://www.plungeinteractive.com/blog/2012/10/29/using-cocosbuilder-on-cocos2d-x-games/
There is another way of using it.We can use cocostudio also and export the file as JSON
Refer to this link
http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html
I have to design a GUI using Qt. I would like to draw multiple lines depicting relationships between two objects. It's the same idea as matching a word with a definition by drawing a straight line (which might be a diagonal) between the two.
In my case it is an a label (with image inside of it) that needs to be matched with another label.
So we have something like this - http://dl.dropbox.com/u/46437808/DrawLines.png
And I want to add lines to make it look something like this http://dl.dropbox.com/u/46437808/DrawLines2.png
I need to do this in run time because the relationship will be changing based on different factors.
Thanks!
Do you need interaction or is this just an image that the user needs to see based on other information? If it's just a static image, I would simply draw it onto a QImage and show it. That way you have complete control over how things are drawn. So you can either cache the relationship diagrams you need ahead of time, or just draw them on the fly onto the QImage based on the relationship that needs to be displayed at the time. You can look at Qt's painting example for some ideas on how to accomplish what you need.
If you need interactivity, I would probably go with the Graphics View Framework. This way if you need push buttons, check boxes, etc. for any reason you can use the QGraphicsProxyWidget to get them, or you can just make your own from QGraphicsItem subclasses.
Hi guys
I am new to the cocos2D.In my game i have one scene and several layer to display Menu,pause,level finish,game over. now i want to find out the layer which is being used on top of the scene. i already tried and got the solution to solve it by using boolean variable for every layer. but this is not a good way to use i thought.
please provide some suggestions
Thanks
Riash
You can simply keep a pointer to the active layer. And it is better to have different scenes for every game state because in this case your management will become much simpler. That's because typically your game scene will have more then one layer. For example: background, level objects, controls and so on.