(no.00004) iOS implementation brick Games (15): implementation of missile launch props (UP)

Source: Internet
Author: User

Panda Pig • Patty original or translated works. Welcome reprint, Reprint please indicate the source.
If you feel that the writing is not good please tell me, if you feel good please support a lot of praise. Thank you! Hopy;)

In the previous article we achieved 3 ball props, but it seems to be not fun, if you can make the rebound stick more "offensive" good, then this article we let it launch missiles directly destroy bricks!

Features of missile props

We want to implement the following functions:

    • The rebound rod touches the missile prop star and "grows" a cannon tube
    • The gun is fired to the front of the missile at timed
    • The missile hits the brick, destroys it, or flies out of the screen.
    • After a certain amount of time, the cannon tube disappears and the missile launches.

There are many ways to grow a gun on a stick, as the rebound rods have different shapes (long, short, and normal), so take into account the gun-tube behavior at different lengths.

We don't care what the length of the rebound stick will allow it to fire the shells. In this case, we have to build 3 new rebound rods with cannon tube, which is rather troublesome. It is better to create a cannon tube in only one place, regardless of the current length of the bounce stick.

So we just need to create 2 new materials: Cannon and missiles.

Create footage

Use AI to create a gun-like stuff, and then export it as a PNG image, as follows:

Then the missiles were made, because we wanted the missiles to have a flying animation, so we needed to make at least 2 pictures, similar to slices:

A tail with flames, so that two pictures to form a missile flight animation.

Drag 3 new pictures into Spritebuilder:

Creating a missile wizard in Spritebuilder

Because the cannon is created on the fly, and there is no change, we create it directly in the code. In Spritebuilder we just need to create a good missile wizard and animate the flight.

Create a new BULLET.CCB file in Spritebuilder with the type Sprite. Animate in Timeline with 2 images you've previously authored:

As for how to make the animation, the previous series of the blog is very clear, if not clear, you can look at the previous blog post, or directly ask me.

Next turn on its physical object, physical boundaries do not need to be very consistent, as long as the head and the missile head match can be:

It is worth noting here that we do not need to set a custom class for the missile, because it is only used as an elf, there is no other extension, so it is good to keep it;)

In the next article, we will implement the missile props corresponding code, originally wanted to put in an article, but found too long.

So I'll see you in the next article;)

(no.00004) iOS implementation brick Games (15): implementation of missile launch props (UP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.