cocos study notes

Billion, Preface

  The essay is a blogger learning cocos study notes, presentation is very simple, only the most entries, something similar to the same directory, after the new harvest will be updated.

  If an error, or have any suggestions, welcomed the discussion.


 

First, the node level and

  Level: Elf layer, the scene layer, UI layer

  Rendering order (game design): Scene (scene), (parent) node (node), Elf (sprite), action (action)

  ps: classes are subclasses of Node: Scene, Layer, Sprite, Menu and Label class, the above sequence of main game design order

  The presence of z-order node class (called the z-axis) property, to control the rendering priority order (if not set, are rendered in a stack manner), the order of rendering the affected node field of view coverage and response order click event

  Node life cycle:

 

Second, the camera

  And use the same node, you need to set camera flag

  Camera perspective: nearly far smaller perspective effect for 3D or pseudo-3D games

  Orthogonal cameras: such as the size, 2D game

Third, the wizard

Fourth, action

  Basic actions: jump (jump), fade out (fadein, fadeout), the absolute and the relative movement (moveto, moveby), absolute and relative rotation (rotateby / to), absolute and relative transparency gradients (scaleby / to), absolute and relative curvilinear motion (bezierby / to), the progress bar moving (progress)

  Operation control: Delay (delaytime), the shift (speed), parallel (spawn), serial (sequence), cyclic (repeatforever), a callback (cb)

Five, UI controls

  Button, RadioButton, ScrollBox, Text, Animation, Radio group (usually together with Radio button)

Sixth, the event listener

  Z-axis affects the response sequence, if the node is set up (click) swallowed the message, then the event will not be passed on

  键盘: onKeyPressed,onKeyReleased

  Touch click: onTouchBegan, onTouchMoved, onTouchEnded

Seven timers

Eight, communication

  * Http protocol: + url + protocol type data, or the reference transmission java ajax

  socket protocol:

 

  Socket Communications third-party libraries: ODSocket

  Process:

1. Initialization: Init (), Create ()

2, preparation of nested words, Type: stream socket (SOCK_STREAM, TCP connection), Datagram socket (SOCK_DGRAM, UDP connections), raw sockets (SOCK_RAW, IP connection)

3, create a connection: Connet (ip, port)

4, sending and receiving data: Send (string, lenght), Recv (string, lenght, 0)

5, close the connection: Close ()

Official development requires strict control of communication, you need to the original communication protocols were repackaged.

9. Other

Guess you like

Origin www.cnblogs.com/end-emptiness/p/11546414.html