You have to destroy the poison particles when they hit the ground to not overwhelm the game engine. You can see how to destroy particles.
- [Instructor] Since we're spawning particles continuously…with our new poison barrel, it's important…that we destroy the particles or else our game…can get overwhelmed and the physics simulation could crash.…Let's open up our barrel object,…and we'll wanna check every step of the frame…and destroy the particles once they get…to the bottom of the barrel.…Let's add an event, select step, and step event,…control tab, and drag in some code.…I'll do a triple slash comment…and say destroy particles.…
We have a couple of different functions…we can use to destroy physics particles.…Most of them will define a region in the room…that when a particle contacts it…the particles get destroyed.…We can define a circle or a square or a polygon…and in this case we'll define a rectangle…that will exist at the bottom of our barrel…so when the particles fall off the side…and contact this rectangle, they're destroyed.…We use the function physics, particle,…delete and region box.…
This takes four arguments, the first two of which…are the x and y location where we wanna start our box.…
- Setting up basic game components
- Creating the player object
- Using Finite State Machines
- Making the player duck
- Creating physics fixtures in code
- Creating physics obstacles
- Box2D liquid physics
- Creating particles that behave like water
- Creating a floating blocks obstacle
- Creating a swinging chain obstacle and a rope bridge
- Adding the finishing touches
Skill Level Beginner
1. Set Up Basic Game Components
2. The Player Object
3. Create Physics Obstacles
4. Liquid Physics
5. Decorate the Level
6. Finishing Touches
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.