Giter Site home page Giter Site logo

cocos2d-x-samples's Introduction

Cocos2d-x-samples

[TOC]

Contains different samples that show how to use Cocos2d-x v3.2 with 3rd party libraries:

Running the samples

Download

$ git clone https://github.com/cocos2d/cocos2d-x-samples.git
$ cd cocos2d-x-samples
$ python download-engine.py

Running

Once the samples were downloaded just go any sample, and open the project. eg:

$ cd cocos2d-x-samples/samples/LiquidFun-Testbed/proj.ios_mac
$ open LiquidFun-Testbed.xcodeproj/

Available samples:

LiquidFun

Based on Box2d, LiquidFun features particle-based fluid simulation. Game developers can use it for new game mechanics and add realistic physics to game play. Designers can use the library to create beautiful fluid interactive experiences.

We provide 2 samples:

LiquidFun - Testbed

Testbed

The Testbed that comes with LiquidFun, adapted for cocos2d-x.

Supported platforms:

  • iOS
  • Mac
  • Win32

LiquidFun - EyeCandy

Eye Candy

The Eye Candy demo that comes with LiquidFun, adapted for cocos2d-x. Includes two useful classes:

  • LFParticleSystemNode: Wraps a LiquidFun b2ParticleSystem into a cocos2d-x node.
  • LFPhysicsSpriteNode: Wraps a LiquidFun b2Body into a cocos2d-x node.

Supported platforms:

  • iOS

GAF

From GAF homepage:

"GAF stands for Generic Animation Format. GAF is designed to store Flash animations in an open cross platform format for further playback in a multitude of game development frameworks and devices. GAF enables artists and animators to use Flash CS for creating complex animations and seamlessly use them with various game development frameworks."

This sample shows how to use GAF with cocos2d-x. It has 5 different GAF samples and shows how to play sound events with GAF.

Supported platforms:

  • iOS
  • Android

MoonWarriors

Alt text

This is a built-in showcase of Cocos2d-JS, including many features just as:

  • Parallax background
  • Tilemap
  • Actions
  • Ease
  • Frame animation
  • Schedule
  • Labels
  • Keyboard Dispatcher
  • Scene Transition.

Art and audio is copyrighted by Enigmata Genus Revenge, you may not use any copyrigted material without permission.

This showcase is licensed under MIT. You’re welcome to use this as a simple tutorial for your upcoming html5 game

Supported platforms:

  • iOS
  • Mac
  • Win32
  • WinPhone
  • Android

KillBug

This is a type of mini-games to test agility of cocos2d-lua, the players need to kill the spider which kept move into the middle hole.

Alt text

Supported platforms:

  • iOS
  • Mac
  • Win32
  • Android

How To Create New Samples

1、init environment

$ python download-engine.py

$ cd libs/cocos2d-x

$ python setup.py

2、create new sample

$ cd samples

$ cocos new ProjectName -l [cpp or js or lua] 

attension: only create projectName in samples dir, it will be compiled correctly

cocos2d-x-samples's People

Contributors

fusijie avatar jianglong-zz avatar mannewalis avatar minggo avatar pandamicro avatar ricardoquesada avatar samuele3hu2022 avatar smartcat avatar teivaz avatar timur-losev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocos2d-x-samples's Issues

Rendering one deformable texture on top of one elastic particle group

Hi ricardo, thanks for the great sample!

I've some questions as I need to render textures on top of each particle group to make jelly simulations (e.g. the one in Loco Roco PSP game). I've been googling but can't find much help maybe due to the wrong keyword... Do you have any idea?

I've seen people doing that on Torque2D: https://www.dropbox.com/s/jscm9pks87c4ohl/Squishy.mov

So I think it must be possible on cocos2d as well, just the technique of doing it without shaders...

Thanks!

Ref: http://www.garagegames.com/community/forums/viewthread/133753/2#comments

Compiling LiquidFun-Testbed Xcode 10.2 - Missing files on compile-time

Should these examples work out of the box?

I've been following the steps from https://github.com/cocos2d/cocos2d-x-samples exactly, namely

Download

$ git clone https://github.com/cocos2d/cocos2d-x-samples.git
$ cd cocos2d-x-samples
$ python download-engine.py

Running

Once the samples were downloaded just go any sample, and open the project. eg:

$ cd cocos2d-x-samples/samples/LiquidFun-Testbed/proj.ios_mac
$ open LiquidFun-Testbed.xcodeproj/

However, when I build the LiquidFun-Testbed.xcodeproj, I get

Showing All Errors Only

Prepare build
note: Using legacy build system


Build target libcocos2d iOS of project cocos2d_libs with configuration Debug


Build target LiquidFun-Testbed iOS of project LiquidFun-Testbed with configuration Debug

clang: error: no such file or directory: '/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp'
clang: error: no input files

clang: error: no such file or directory: '/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/Collision/b2Distance.cpp'
clang: error: no input files

clang: error: no such file or directory: '/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/Common/b2StackAllocator.cpp'
clang: error: no input files



Build failed    06.01.20, 22:25    698.2 seconds

Clearly, the compiler is looking for files in
/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/

but these were never created.

After following the mentioned steps above, Box2D and its code are instead placed in
/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/cocos2d-x/external/Box2D

...So why is it looking for these files in

/Users/Chris/Desktop/source/repos/3rd party libraries/cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/??

python2 is dead. Kindly update the download-engine.py

Support of python2 ended in 2020. It still exists and can be used to run python2 scripts, but in the end, things can get worse. It's better to adapt it to the python3 version. After all, it's a tiny script, it can't be so hard.

Download engine script fails on 404

Max@maximilians-mbp ~/D/C/C/cocos2d-x-samples> python download-engine.py
=======================================================
==> Prepare to download cocos2d-x engine!
==> Ready to download 'cocos2d-x-3.8.zip' from 'http://cocostudio.download.appget.cn/Cocos2D-X/cocos2d-x-3.8.zip'
==> Error: Could not find the file from url: 'http://cocostudio.download.appget.cn/Cocos2D-X/cocos2d-x-3.8.zip'
==> Http request failed, error code: 404, reason: <html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.10.1</center>
</body>
</html>

How to integrate and run LiquidFun-TestBed in cocos2d-x 3.2

Hello,

I am trying to run LiquidFun-TestBed in eclipse with cocos2d-x 3.2. On importing the project in my workspace, the project gives error in AppActivity.java file that "Cocos2dxActivity cannot be resolved to a type". Can somebody help me with this issue.

LiquidFun-EyeCandy missing Box2D folder?

It seems that LiquidFun-EyeCandy is missing the Box2D folder. Could I just find it from somewhere else and drop it in? Maybe I should get it from the LiquidFun repository?

Swift sample does not with with xcode6 beta4

Due to some changes in Xcode6 beta4, the Swift example does not work out of the box.
A line like
var a = CGFloat(aFixedValue)
results in an error saying CGFloat is not convertible to UInt8. It can be fixed with an extra cast
var a = CGFloat(Uint(aFixedValue))
but I doubt this is the right solution in the long run

xcode 8 build error

"_CTFramesetterCreateWithAttributedString", referenced from:
"_CTFramesetterSuggestFrameSizeWithConstraints", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Blank screen for Liquidfun-testbed problems on XCode 8.3.3

Following the instructions through:

git clone https://github.com/cocos2d/cocos2d-x-samples.git
cd cocos2d-x-samples
python download-engine.py
cd cocos2d-x-samples/samples/LiquidFun-Testbed/proj.ios_mac
open LiquidFun-Testbed.xcodeproj/

Now I attempt to build and it seems the Liquidfun folder is missing -

Showing Recent Issues
No such file or directory: 'cocos2d-x-samples/libs/liquidfun/liquidfun/liquidfun/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp'

Checking in the shell reveals the liquidfun folder is empty:

#ls cocos2d-x-samples/libs/liquidfun/liquidfun
.
..

To try and remedy this I downloaded LiquidFun separately, and placed it in the requested folder. This enabled compilation to complete, but when I run the macOS version I am presented with a black/blank window. Interacting with the window (keys / mouse presses) produces logs as expected.

jni/../../Classes/EyeCandyLayer.cpp:146:24: error: aggregate 'b2ParticleGroupDef pd' has incomplete type and cannot be defined b2ParticleGroupDef pd;

I tried to import EyeCandyLayer sample for android with Cocos2d-x V 3.1 and got only the above issue. When I even comment the Particles out all the above issue will be gone. The full trace is shown below

jni/../../Classes/EyeCandyLayer.cpp:146:24: error: aggregate 'b2ParticleGroupDef pd' has incomplete type and cannot be defined
b2ParticleGroupDef pd;
^
jni/../../Classes/EyeCandyLayer.cpp: In member function 'void EyeCandyLayer::initPhysics()':
jni/../../Classes/EyeCandyLayer.cpp:146:24: error: aggregate 'b2ParticleGroupDef pd' has incomplete type and cannot be defined
b2ParticleGroupDef pd;
^
make: * [obj/local/x86/objs/cocos2dcpp_shared//**/Classes/EyeCandyLayer.o] Error 1
make: * Waiting for unfinished jobs....
make: * [obj/local/armeabi/objs/cocos2dcpp_shared//
/Classes/EyeCandyLayer.o] Error 1
make: Leaving directory `/home/paulos/workspace/GameTest/proj.android'
Traceback (most recent call last):
The Selected NDK toolchain version was 4.8 !
File "/home/paulos/workspace/GameTest/proj.android/build_native.py", line 166, in
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
File "/home/paulos/workspace/GameTest/proj.android/build_native.py", line 153, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "/home/paulos/workspace/GameTest/proj.android/build_native.py", line 89, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ /home/paulos/workspace/GameTest/proj.android ] fails!

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.