As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!

52,853

Views

Beginner

Level

36

Comments

Abigayl's Interactive Tutorials (Part 4)

by Joe (Updated on 2012-07-21)


Tutorial 4 - Mouse-based Shooting, Collisions, and HP

 

CHANGES TO CURRENT STENCYL VERSION:

  • Game Center is now Dashboard
  • Collisions Groups are now in the Settings button at the top of the page
  • No longer need to make Actor Behaviors; use "Events" tab instead
  • Now need to use “Add an Event” at the top left to make the headings
  • If using events, do not need to "Attach to Actor" (still needed with Behaviors though)
  • Collisions between Actors are now handled by collision events (use "Member of Group" and change the group to "Actors")

 

Liked this one? See them all!

Part 1: The Basics

Part 2: Attributes, Saving/Loading, Kongregate API

Part 3: Advanced Controls, Spawning

Part 4: Mouse-based Shooting, Collisions and HP

Part 5: Music, Screen Boundaries, Backgrounds, Power-ups and More

Part 6: Virtually Lagless Actors

Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!

36 Comments

Erikas Taroza
Hi Abigal,
I have a question about the shooting. How do I make it so then the bullet shoots where my character is facing? (I have made my character face different ways accordingly to the movement)

Thanks

0 7 years, 3 months ago
Gurpegui
Hello Abigayl, nice work here!

I'm having a problem with the code "Decreasing HP by 1". I think it's because some changes in the software but I can only use this code "Decrease 'Numer' (and I can't change it and put HP) by 1" and I get an error compiling.

0 7 years, 10 months ago
MomoSkySky
Great tutorial again! For those of you having slowdown issues, make sure that enemies aren't set to collide with each other (in the "Actor" group settings). This causes collision detection at several thousand points where the enemies are spawning, which drives the Box2D engine crazy!
-1 8 years, 5 months ago
Cloudxjr
Hi Abigayl! I was able to do everything! And it works! Very nice!
There's only one problem! When I Test the game, it begins without any interruption, but when the actors increases, the game turns to be no more continuous. It becomes slow and jerky.

Maybe this happens because of my computer, or maybe because of my actors. These ones are a little more elaborated than yours in the tutorial.

Are you able to give me an answer for this problem? Thank you so much!

-1 9 years, 11 months ago
fireflare
Download Jump'o man!

Please

-1 11 years, 3 weeks ago
RoverOver
Hi Abigayl, i just logged in to thank you, your tutorial is a wonderful resource, the explanations are clear... and i wont lie to you, sometimes i get lost, but its not your fault xD, my english is not so good, but this program and your help make me feel like a programmer! thanks again
2 11 years, 7 months ago
spidermax
Hey Abigayl!

Really been enjoying going through these tutorial videos so far! However, I am having some difficulties with 2 different things, and both seem to deal with Stencyl not responding to certain stimulus.

1. The code I have for collisions between bullets and enemies seems to be the same as you have in your tutorial... however: while the objects CLEARLY collide (the bullets bounce off and die), the enemies don't seem to get affected (I built the HP and stuff and all that seems ok). I have tried to debug by using a print HP command after an enemy hits ANYTHING - but nothing prints? Where should print stuff come up for the debug process?

2. When I put ANYTHING in a 'Drawing' event that I create, it doesn't seem to Draw. For example: I have exactly what you have for the drawing the HP bars and nothing shows up.

Thanks!!

0 11 years, 7 months ago
Abigayl
Sabir, make sure you're using the degrees and radians correctly. The conversions using sine and cosine often need to be in radians, but the angles for the movement need to be in degrees.
0 12 years, 2 months ago
Sabir1877
Hi Abigayl,
I rely like your tutorial videos, but I seem to have a problem. All of my bullets fire in one direction. Can you help me out with that?

0 12 years, 2 months ago
Xietao
I can get 2231 score only using shooting
-1 12 years, 3 months ago

Sign In to Comment