Games Achievements My Kong Sign In

Comments for Stencyl Tutorial 4: Mouse-Based Shooting

« Back to Stencyl Tutorial 4: Mouse-Based Shooting

Abigayl

Dec. 17, 2011

Under rating threshold (show) Please rate this comment up if you would like to see more tutorials about Stencyl (and please comment yourself about what you would like me to cover) so that I know what you are interested in seeing. Thank you.

+ - !

(80)

Developer response from Abigayl

Please read the News Posts for information on changes to the current Stencyl version. I will do my best to keep it updated for all of you :).

ItsFunToLose

Jan. 02, 2012

Under rating threshold (show) Hi Abigayl, I want to start off saying I love your tutorials, they're very helpful. I have a problem with the way you've coded the HP attribute. I have followed your coding exactly, but bullets subtract 1 or 2 health from enemy targets, and very rarely even 3 HP per bullet. ( and I noticed this problem in your demo as well, its just masked by the large number of bullets, and thus hard to notice if one bullet is doing 1 or 2 damage to a 3 HP target.) Is there any way to code the HP so that this does not occur? any insight into why this is happening at all? Recap: I set enemy HP to 10. I code so that if HP > 1 to decrement HP by 1. else kill. I print the HP value rather than a picture bar. about 40% of the time, One bullet takes enemy from 10 HP to 8 HP. Rest of the time, HP from 10 to 9. Halp.

+ - !

(19)

Developer response from Abigayl

Aye, you are correct and yes the sheer number makes it so I missed that error. The simplest way to correct it is to add an extra code in the "EnemyMotion" behavior. Just before the "if HP > 1", drag in a kill code (from Actor -> Properties) and change it to say "kill last collided actor". That should work.

netgeneraal

Dec. 29, 2011

Under rating threshold (show) I would like to know how to make an upgrade system like that you can buy auto shooter.

+ - !

(16)

Developer response from Abigayl

The next tutorial goes over how to make a powerup, which you should be able to manipulate to change shooting or other things (I suggest using a game attribute for something permanent like that). If you want me to show you how to change it after the tutorial comes out on Saturday, let me know and I can stream it for you (livestream.com/poweredbyflowers).

Abigayl

Jul. 24, 2012

Under rating threshold (show) Thank you all for your ratings! This is now a "legendary" tutorial (over 4.0 with 500+ votes). :)

+ - !

(6)

lukabalen

Jan. 08, 2012

Under rating threshold (show) I would like to see and learn how to make a realistic gun. How to add recoil, gravity to bullets, knockback and other stuff.

+ - !

(14)

Developer response from Abigayl

Will keep that in mind for future tutorials, but it's a lot more complicated than this, so might be much later to see if I can even simplify it to a tutorial.

Travis0902

Apr. 14, 2012

Under rating threshold (show) Make a tutorial on how to rate 5 stars. Because some people dont know how to do that at your game. But I do. :) 5/5

+ - !

(7)

Developer response from Abigayl

Thanks for your support and for making my day :D

strit5

Oct. 31, 2012

Under rating threshold (show) Thanks a lot! :) I really like that you respond on all comments :D

+ - !

(2)

Developer response from Abigayl

You're welcome ;)

snackman76

Jan. 04, 2012

Under rating threshold (show) best tutorial ever!!!!! i changed up a few things in it and instead of my mouse as the aim and shooter i made my space bar because i learned alot from you. 5/5 just as i rated your other tutorials

+ - !

(9)

Developer response from Abigayl

Thanks Snackman. I'm glad to be able to help :). I'm also happy to hear about people taking my ideas and making them their own. My desire is not to see a bunch of copies but rather people expanding on the ideas I laid out, which it sounds like you are doing.

Darksaber530

Apr. 24, 2013

Under rating threshold (show) I followed this tutorial exactly and I have a 75 tile long screen (each tile is 32x32 and the character is 30x90) and when my character passes oh say about the 1/2 way mark across the level, the bullets only shoot in the left direction! The ip and down is fine, to a point, where they wont pass about 45 degrees in either direction. Once I pass over the halfway mark again, the bullets act correctly. Help!

+ - !

(0)

Developer response from Abigayl

When making a scene bigger than one screen, you need to add to the player: "always move camera to self" and add the x/y of the camera to the x/y of the mouse in the atan code.

BaoetTam

Jan. 12, 2013

Under rating threshold (show) 5/5 because this tutorial is awesome and because 100% of revenue goes to charity.

+ - !

(2)

Developer response from Abigayl

Thanks :)

nzjackass

Apr. 06, 2012

Under rating threshold (show) kk thx i like how you respond to every single comment and very quickly aswell 5/5 to all of your tutorials

+ - !

(2)

Developer response from Abigayl

Thanks for the 5's. I do my best to answer comments (although the best methods are via my livestream or via PM).

death1hand

Apr. 03, 2012

Under rating threshold (show) please can you do a graphics tutorial, my code is ok but im rubbish at graphics

+ - !

(2)

Developer response from Abigayl

My graphics are generally pretty bad too, unless I spend a LOT of time on them. That come down more to networking. There are forums on Stencyl.com to find artists/musicians to work with or DeviantArt is another good choice.

ItsFunToLose

Jan. 02, 2012

Under rating threshold (show) I managed to fix this using a boolean flag similar to how you restricted the firing speed in the previous tutorial. a "do after 0.05 seconds" block to reset after decrementing the HP was sufficient.

+ - !

(3)

Developer response from Abigayl

Thanks, yes, I have had that problem in the past (took me a while to fix in Holiday Block Breaker), and that is indeed the fix. I rated up your comment so hopefully others will see it too (unfortunately, my base file for tutorial 4 was damaged so I cannot update it directly).

strit5

Oct. 30, 2012

Under rating threshold (show) What to do when your own bullets hits your own actor? Cause I cant get the bullets in front of my actor so he can shoot the enemies. My actor hits himself and then the bullet is gone

+ - !

(1)

Developer response from Abigayl

Check your collision groups to make sure the bullet's group is not set to hit the player's group. If needed, make a new group to do it.

strit5

Oct. 30, 2012

Under rating threshold (show) Oh man!! I just watched whole this tutorial, and then I find out that I also need to watch 2 and 3.. -.-

+ - !

(1)

Developer response from Abigayl

What about Tutorial 1? :P

chinotacua

Aug. 31, 2012

Under rating threshold (show) Thanks!, you're the boss :p

+ - !

(1)

Developer response from Abigayl

Well... I own my own tutoring business, in which I am the only employee... so I am both boss and employee... :P. Anyways, glad you liked it! :D

doodle_man

Jul. 26, 2012

Under rating threshold (show) OMG I really need your help to make my game.What ever I do it sometimes work like I cant get score I cant find out how to make the enemy's move left to right by them self because I am trying to make a maze game so I cant have the enemy's spawning all over the place.Please help me I would love you if you did help me. <3

+ - !

(1)

Developer response from Abigayl

Best way to reach me in real time is via my livestream: livestream.com/poweredbyflowers

Mat2PL

Jul. 23, 2012

Under rating threshold (show) I have to admit that this tutorial is best if you need help in starting "programming" in stencyl, very usefull and simple. tuvm.

+ - !

(1)

Developer response from Abigayl

You're welcome :)

Gallade

Feb. 11, 2013

Under rating threshold (show) I went from understanding jack-butt of Flash Game making to...well, understanding the bare basisc of Flash Game making. Thanks!

+ - !

(-1)

Developer response from Abigayl

lol, you're welcome... I think :P.

nzjackass

Apr. 06, 2012

Under rating threshold (show) when u shoot the enemys on your game how did u make them rotate when hit? is it just default or what

+ - !

(1)

Developer response from Abigayl

It's generally the default. To turn it on/off, go into the the physics tab of the actor and turn on/off rotation freely.

monsterjamp

Mar. 25, 2012

Under rating threshold (show) I followed your tutorial again and saw i used "Group for this actor's colliding shape" instead of "group for colliding shape". Now the bullets work properly. But may i ask you what is the difference between those 2. P.S. Thanks for your help but i may keep asking questions later on but right now I'm doing good.

+ - !

(1)

Developer response from Abigayl

The "group for this actor's colliding shape" is a very rarely used code, but it is indispensable to some programmers. It is designed for those who use multiple collision shapes on a single actor, such as animation that includes a sword. Those animations can have multiple different groups attached, and that code allows programmers to figure out which one was hit. For the majority who use one collision shape per actor, it's not needed.

arit3

Feb. 09, 2012

Under rating threshold (show) Dunno if this will be read.. how to make an actor point towards the mouse cursor continuously?

+ - !

(1)

Developer response from Abigayl

I read all comments. To make the actor point towards the mouse cursor, follow the same idea in this tutorial (with the arctan2 coding) but instead of setting the bullet's velocity in that direction, use "point self to x degrees" under Actors -> Position. Note that I think you have to add 90 degrees to the amount you get for the pointing to work properly, and in order to point continuously, it will need to be in the "always" heading... I will caution you that doing a trigonometric function in an "always" heading can lag the game a bit, so I would not advise using the code if it is an intensive CPU game. Hope that helps.

ChazDragoon

Jan. 14, 2012

Under rating threshold (show) alright i got it...seems i forgot the whole local/global attribute thing. :s Thanks Abi.. ^-^ Also, on a side note, i decided to make a key press to start the game from title screen than clicking the start button. Just so i stick it in my head...what is the big difference between a local and global attribute?

+ - !

(1)

Developer response from Abigayl

Aye, key presses are good. The difference is that local attributes are ONLY used by the current behavior (and for each individual actor, aka: multiple enemies with the same behavior can have different local attribute values). Global (game) attributes are used by any behavior, and if the value changes one place, it changes everywhere. Also, local attributes are not saved/loaded whereas game attributes are.

ChazDragoon

Jan. 14, 2012

Under rating threshold (show) Found the problem..but i can't do anything about it. It's the Increment/Decrement...it won't let me change it from "number" to HP. Yet i created the HP attribute as a "number". Also of note, i only have 4 options when making an attribute while your Tutorial shows...more. Either i'm running an old version (which seems odd cause i got it less than a week ago) or..i dunno. *confused!*

+ - !

(1)

Developer response from Abigayl

Chaz, the issue is likely that you are trying to use a game attribute (purple) for the HP when you should be using a local attribute (blue). Try making a new local attribute for HP and use that instead. Let me know if it still glitches.

ChazDragoon

Jan. 14, 2012

Under rating threshold (show) Upon some messing around..it's something with the HP code..when i removed it i could test my game..when i put it back in..i couldn't. hmm..must of missed something.

+ - !

(1)

cucumkid

Dec. 23, 2011

Under rating threshold (show) Really enjoying the tutorial series, wonderful step by step approach. I think the way the development of the tutorial game has progressed, it would be interesting to see each new development as an additional level, with the design for integrating levels into a game, with progress indicators, checking the score or achievement on each level to progress, a selector on the opening screen for picking opened levels and how to save level progress for the user between games in the sol / saved information.

+ - !

(1)

Developer response from Abigayl

Seems like my last reply got deleted somehow... I will try to fit as much of that into Tutorial 5 as possible. Thanks for the suggestions :) EDIT: I have just finished the foundation for Tutorial 5, and unfortunately, level select does not fit, primarily since I need to have multiple levels to show how to do a level select coding...

qwertyuiopazs

Mar. 28, 2012

Under rating threshold (show) I would love it if at the end you showed a picture of all the coding you changed so I could fix my mistakes without having to go through the tutorial at the end.

+ - !

(-1)

Developer response from Abigayl

There are so many areas that can change that it's hard to do a screenshot of all of the updates... would require a couple of slides just to show all of the code. I tried to do something similar by having recaps, but I know it's not quite the same thing.

snackman76

Jan. 02, 2012

Under rating threshold (show) my bullet is just weird looking i dont even see it on the screen. idk plz message me back threw pm and help me cause i rlly wanna become as good of a game maker as you

+ - !

(-1)

Developer response from Abigayl

I've replied to the PM. I highly advise coming to the livestream for one-on-one help. Even if I am not on, there are other regulars there who might be able to help out.

Abigayl

Dec. 17, 2011

Under rating threshold (show) I am curious at how many people come to these tutorials just to play the game at the end, using "2" to skip there. If you are one, please rate this comment up (else please don't :P). Thanks.

+ - !

(1)

Halagaz

Dec. 18, 2011

Under rating threshold (show) I hope it's not the last one! I've just need to study trigonometry a little bit (as well as English)) and I hope I'll make at least one stupid game) Oh, my mistake, I should say thanks first! Thanks a lot!!!

+ - !

(1)

Developer response from Abigayl

lol, you're welcome. I'm glad to be of help :). The fifth one will be the last one for a while. (I may do a second set focusing on platformers when SW2 comes out).

ZhaneEndrick

Dec. 17, 2011

Under rating threshold (show) Abigayl, thanks again for a wonderful tutorial. I think you are covering Stencyl at a really useful pace. I've been poking around the program for a few months, but have always run into problems figuring out how to do things. I'm beginning to understand the steps that need to be taken. Even though I'm not working on an 'avoider' game, this has helped me with what I am doing. Oh, and it has also reminded me that I'm a little rusty on my trig, need to crack open some old math books. I'm really enjoying this series and it is helping me a lot. I'll be eagerly awaiting your next tutorial.

+ - !

(0)

Developer response from Abigayl

Thanks Zhane :). The fifth tutorial will be my last for a while. I am glad to see that people can look past the idea of this being an avoider game and use the actual concepts to help them with their own games :)

aronzei

Dec. 17, 2011

Under rating threshold (show) I'm grasping more and more about Stencyl with every new tutorial. Thank you. :)

+ - !

(0)

Developer response from Abigayl

Glad to be of help :)

PaulisterGaming

Apr. 08, 2012

Under rating threshold (show) HELP! For some reason I can't fire the bullets!!

+ - !

(0)

Developer response from Abigayl

Are you sure you attached the behaviors? If you want, upload the game to Forge and send me a PM with its name and I'll take a look at it to see what's wrong.

qwertyuiopazs

Mar. 29, 2012

Under rating threshold (show) Oh, I accidently did create bullet at (x:x of self, y: x of self.) by the way the bullets weren't going where i clicked, they were going at what seemed to me as random places, and I just happened to click on two in a row and assumed wrong.

+ - !

(0)

Developer response from Abigayl

So it works now? If so, good (couldn't really tell by your post)

alobalo1

Dec. 18, 2011

Under rating threshold (show) can you make it in a bigger screen?

+ - !

(0)

Developer response from Abigayl

Unfortunately, I cannot. I am almost up to the maximum horizontal size allowed and to make the pictures bigger would increase the file size quite a bit :(

DemonOfMist

Apr. 20, 2015

Under rating threshold (show) Re-did this tutorial. I had to refresh some of the trigonometry by referring to some websites, but I got it. Thanks!

+ - !

(0)

Developer response from 0_Tuo_0

I'm glad you got it down :)

DemonOfMist

Apr. 13, 2015

Under rating threshold (show) I had to tweak the collision part (the colliding shape detector) a bit to make it work due to updates. It works, but hope it will not cause problems when I finish tutorial 4.

+ - !

(0)

Developer response from 0_Tuo_0

You have me curious: what tweaks did you need to do?

DemonOfMist

Apr. 13, 2015

Under rating threshold (show) Found it! You can check width in Stencyl under collision tab of the actor.

+ - !

(0)

Developer response from 0_Tuo_0

If you are constantly changing the size, a draw text and/or print command can work in real time too ;)

DemonOfMist

Apr. 13, 2015

Under rating threshold (show) Do we always have to open paint to find out what is the width of our actor? Is there a way to check in Stencyl?

+ - !

(0)

Developer response from 0_Tuo_0

There are many ways, including the collision tab (I often create a new box collision and then cancel as it will show the actual size if I've adjusted the collision box currently on it).

DemonOfMist

Apr. 13, 2015

Under rating threshold (show) Trigonometry... I learned that stuff so long ago wondering why I ever did, but now it comes down to this....

+ - !

(0)

Developer response from 0_Tuo_0

Aye, I use my programming as an example for students who don't see the value in trig ;).

123kenny10

Dec. 04, 2013

Under rating threshold (show) you know the bullet look just like the one i made LOL

+ - !

(0)

Developer response from Abigayl

It's a circle. There really is not a lot of varieties for circles... :P

Toope00

Dec. 04, 2013

Under rating threshold (show) What if the bullet comes from the back of the actor and hits the actor itself?

+ - !

(0)

Developer response from Abigayl

If you have the collision groups set so that the bullet's group doesn't collide with the player's group, then it shouldn't be an issue.

sirmoo2

Oct. 23, 2013

Under rating threshold (show) my actor does not seem to point towards my mouse. i have tried everything. PLEASE HELP!!!

+ - !

(0)

Developer response from Abigayl

If your scene is bigger than your screen, you'll have to add the x/y of the camera to the x/y of the mouse for it work properly. If you post a screenshot of the coding (or upload the game to StencylForge and make it public), I can try to look at it to see what's wrong.

Abigayl

Oct. 17, 2013

Under rating threshold (show) SirMoo: In the Actor -> Position palette, there is a "point self to X degrees". That is what I am referring to.

+ - !

(0)

sirmoo2

Oct. 16, 2013

Under rating threshold (show) I do not see the "face direction" code block you had mentioned earlier. PLEASE HELP!!!!

+ - !

(0)

Abigayl

Oct. 16, 2013

Under rating threshold (show) Hello Sirmoo, For whatever reason, I can't seem to create a response, but yes you can. In the Actor palette, there is a "face direction" code and you can use the same coding for the shooting for that direction (you will likely have to add or subtract 90 though to make it work).

+ - !

(0)

sirmoo2

Oct. 16, 2013

Under rating threshold (show) Hey there! Is there any way i can have my player face the mouse constantly, like turn and face the mouse no mater where it is on the screen? I keep trying but still have no luck :(

+ - !

(0)

roflmoqkz2

Oct. 10, 2013

Under rating threshold (show) For some reason my game crashes when the enemy dies. I did exactley what you did and it doesnt work.

+ - !

(0)

Developer response from Abigayl

Can you describe the crash? Is there an error that pops up? If you want, upload the file to StencylForge (don't forget to make it public) and let me know the name, and I'll take a look at it for you. There's not much I can do without seeing the file itself.

BalsG

Aug. 23, 2013

Under rating threshold (show) Yeah, i can shoot(and move) in only half of image, instead if all image, sorry for my english.

+ - !

(0)

Developer response from Abigayl

Perhaps upload your game to StencylForge, make it public, and tell me the name of it. I'm still not understanding the issue, so seeing it directly might be better.

BalsG

Aug. 23, 2013

Under rating threshold (show) Question is: Why? (see in previous mesage the problem) and how to make to be the full image?

+ - !

(0)

Developer response from Abigayl

I don't understand. Why do you mean "can't shoot in all image"? That was the question.

  • add a comment
Developers Players Support YouTube TikTok X (Twitter) LinkedIn
Join the conversation Join Discord
Terms Privacy Code of Conduct
© 2024 Kongregate