将"Cocos2d-x 精灵碰撞检测(方法一)" update函数修改一下。
使用精灵boundingBox函数获取直接精灵边界框, 不用自己计算精灵矩形大小了,还比较精确,然后调用intersectsRect计算2个精灵矩形是否存在集。
代码:
void HelloWorld::update(float delta)
{
//返回精灵边界框
CCRect cr1 = sp1->b...
分类:
其他好文 时间:
2014-06-07 01:44:56
阅读次数:
187
下面是一个简单的爬虫程序。#!/usr/bin/env pythonfrom sys
import argvfrom os import makedirs, unlink, sepfrom os.path import dirname,
exists, isdir, splitextfrom str...
分类:
其他好文 时间:
2014-06-05 12:50:50
阅读次数:
341
需求是这样的:系统中会有很多的执行时间,三个或者四个这样,不确定,以后可能是五个!当用户在页面添加执行时间时,我们后台也要对应执行用户添加的时间。
数据库设计:
DROP TABLE IF EXISTS `test_time_task`;
CREATE TABLE `test_time_task` (
`status` int(11) DEFAULT NULL COMMENT '状态:0为...
分类:
编程语言 时间:
2014-06-05 10:00:30
阅读次数:
245
File类测试
//根据指定的文件名和路径创建File对象
File file = new File("myFile.txt");
//file.exists();检测文件是否存在
boolean exists = file.exists();
System.out.println(exists);
//按照file对象指定的路径和文件名创建一个新的文件
...
分类:
编程语言 时间:
2014-06-05 09:31:59
阅读次数:
293
很简单的bellmanford题目,这里比较详细:http://blog.csdn.net/lyy289065406/article/details/6645790
直接代码
#include
#include
#include
#include
#include
#include
using namespace std;
const int SIZE=11111;
const i...
分类:
其他好文 时间:
2014-06-03 04:10:45
阅读次数:
182
【题目】
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be use...
分类:
其他好文 时间:
2014-06-03 01:07:58
阅读次数:
329
Given a stringS, find the longest palindromic
substring inS. You may assume that the maximum length ofSis 1000, and there
exists one unique longest pa...
分类:
编程语言 时间:
2014-06-02 09:22:03
阅读次数:
328
其一,所有的递归实现都可以 iteratively
实现,虽然很多时候递归的代码更简洁。其二,递归会产生多余的开销,包括空间和时间。其三,如果一定要递归,不要在一个递归函数里做多件事,最好只做一件。像下面的代码(未完成,因为写不下去了),试图在递归函数里做三件事,(1)
检测路径是否存在(2) 构造...
分类:
其他好文 时间:
2014-06-01 11:32:10
阅读次数:
215
title:
A Pythagorean triplet is a set of three natural numbers, a
b
c, for which,
a2 + b2 =
c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for wh...
分类:
其他好文 时间:
2014-06-01 09:17:53
阅读次数:
251
题目:A Pythagorean triplet is a set of three
natural numbers, a b c, for which,a2 + b2 = c2For example, 32 + 42 = 9 + 16 = 25
= 52.There exists exactl.....
分类:
其他好文 时间:
2014-05-31 01:23:03
阅读次数:
254