How do I make a bullet sprite spin as its moving?

Get help using Construct 2

Post » Tue Mar 25, 2014 11:20 pm

You guys are going to HATE me, but I'm STILL confused... for example, I looooooooooove the spinning effect that you made with the Axe. HOWEVER, if I move the log (sprite4) to a different location, the axe does NOT spin while going towards the log... the axe only spins while going across the screen... I want the axe to spin while going towards the log (wherever the log is -- which eventually will be moving).

I TRIED to add the bullet behavior to the axe, and I TRIED to say:
System - Every Tick - axe - set angle toward (wood.x,wood.y) -- but this stuff didn't work.

.. But again.. I could NOT get the axe to spin around while going TOWARDS the wood. I'm sooooooo sorry to be slow with this, but I just don't get it.

PS: It also seems like a LOT of work in the worksheet.. I would have hoped for something like, "spawn axe", then aim at the axe at the wood.. but I'm stumped.

Sooooooooooooorry. :(
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Wed Mar 26, 2014 10:16 am

ok so this is my last go... :)
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Wed Mar 26, 2014 11:09 pm

Message: puzzele can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I can't thank you guys enough for your patience.. and I know you are going to definitely roll your eyes and hate me, but I still do NOT get it.. the examples above do successfully make the axe spin, but it is NOT going towards the wood.

Here is a link to my capx file. PLEASE see if you can modify this capx file so that the axe spins. In my capx file, the axe does follow the moving 'wood', but I can't figure out how to get the axe to spin.

Once again, thanks soooooooooooooooooooo much for your ongoing patience. I honestly don't know what else to try to get the hang of this. Here is the link:

https: // www.dropbox.com/s/vb5ul4v3jn8v3ne/axetutorial1.capx <--- I put spaces by the // because this website doesn't let me include links.
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Wed Mar 26, 2014 11:32 pm

You need a combination of: container, hidden-sprite, Pin.
You do not have the required permissions to view the files attached to this post.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Wed Mar 26, 2014 11:47 pm

blackhornet: You did it! Thanks soooooooooooooooo much. NOW I understand what everybody was trying to explain to me when they mentioned pin.... I never used the 'pin' before.. but now I FINALLY understand. MUCH appreciated. Thank you everybody that helped. :)
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Thu Mar 27, 2014 8:05 am

and were you able to download "axe test 4" from above ? (I ask because the download count was showing "0" and I am not sure if people below a certain rep can download ?)

here is a copy of the "code" - (the pivot-point and the axe are in a container so create one and you get the other)

Ashampoo_Snap_2014.03.27_07h55m32s_001.png


(and here it is running)
https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/axe/index.html
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Thu Mar 27, 2014 3:04 pm

RamPackWobble: Doh! I have no idea how I missed your posting the first time. I didn't even see it until you posted your follow-up message. I am definitely going to download it later when I get home so I can take a closer look at it. For example, I'm still not sure what the 'mirrored' thingy does and the "90 and 270 degree" distinctions confuse me. Is there perhaps a chart somewhere that displays the different degrees? For example, if I want a graphic to go from the bottom of the screen to the top, I sit there and say, "Is that 90 degrees? 180 degrees???"

Also, I have to ask, what is a good way for a novice like me to become better with C2? I could have sat there forever and starred at the screen and I NEVER would have figured out the 'pin' feature that you guys are using. Geesh.. I was sitting there with animated .gifs because I was so desperate.

I did look at the manual but that is a quick summary and definitely not good for a novice like me. I also floated around on youtube and pretty much watched all the tutorials I could find. I prefer video tutorials better. :) Some of the tutorials were really good, but others confused the heck out of me. For example, there was a tutorial about a card matching game. Well, the tutorial spent sooooooo much time using math just to figure out the right number of cards to display on the screen that I gave up... and never made it to the actual tutorial. I used less math throughout my education than this person used in this tutorial just to display the right number of cards.

I similarly looked at the samples in c2.. such as the 'angry birds' clone example... but I just don't get how the mouse mechanism works in the game -- where you launch the stuff to the right...

So if you have any recommendations about a good way for a novice, make that a sloooooooooooooooow learning novice like me, to learn C2, that would be great.. I've got some of the basic stuff down (i.e. making breakout, pong, asteroids, flappy bird) thanks to some GREAT tutorials on this website... but I'm not sure where to go from here.. again.. I NEVER would have figured out the 'pin' solution.. so perhaps there are more tutorial resources available that I'm not seeing? Any advice would be much appreciated.

Thanks again for everyone's help. Really is appreciated. :)
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Fri Mar 28, 2014 12:46 am

Message: puzzele can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Doh! I thought I was going NUTS because I just spent the last 30 minutes trying to create the spinning effect from scratch... I could NOT get it to work... this is what I did:

System -- EVERY TICK -- axe -- pin pin to sprite <-- this did NOT work

Instead, out of desperation since the above didn't work, I had to change it to:

Start of layout -- axe -- pin pin to sprite <-- this worked.

How come the pin doesn't work for every tick? Just curious... because now I'm stuck using 'on start of layout' and so now I'm forced to re-do the 'pin pin to sprite' every time the sprite dies and is thereafter spawned again. What am I missing?

PS: Here is a video on youtube. this shows that it SHOULD work with every tick.. but it didn't work for me and I watched this video a gazillion times:
https: // www.youtube.com/watch?v=on6pzNXcxKw
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Fri Mar 28, 2014 8:19 am

0 degrees is right (ie going left to right across the screen)
put another way if your player is in the middle of a standard clock face 0 degrees is 3 o'clock, 90degrees is 6 o'clock, 180 degress 9 o.clock and 270 degrees is 12 o'clock.

mirrored flips your graphic left to right.

so in my example 4 (which you still do not appear to have downloaded ?) I say is the angle the "axe" is travelling between 90 and 270 degrees (ie going left) then flip the graphic left to right and start it rotating anticlockwise.

you only pin once - then the pinned sprite will move with what ever it is pinned to. Normally this is done when you create the sprites - if the graphics are already on the screen at the start of the game then use on start of layout.

I am learning C2 by picking out small parts of games and working out how to do them - How to move a player to follow the mouse ? How to make the player fire when he is in a certain area only ? how to change the graphics from facing left when my player is moving right ? Just small parts that could be used to make up a whole game. Read though the beginners tutorials (Ashleys especially) and try to understand why they work - please don't just load in the capx or "type in the code" but read the blurb and most of it will be explained.

You will not understand everything at once - I learn something new, or at least reinforce some understanding, nearly every day and that is after a year of using C2 several times a week.

Try to avoid every tick for anything unless it is absolutely needed to be done 60 times a second.

Maths is important.

Not looked at your video link yet.

Good luck.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Fri Mar 28, 2014 10:45 pm

RamPackWobble: Thanks VERY much for your patience and in answering even more of my questions. That certainly helped a LOT. In fact, the ONLY way I could put my brain around the concept of 0 degrees being on the right is to write down your great example of a clock.

Here is a crappy little diagram I made. Perhaps it will help other novices like me to understand where the heck the stuff is on the screen. If somebody said '720 degrees', I wouldn't have a clue where that is on the screen.

I will certainly keep fiddling with Construct 2... so thanks in advance for your ongoing help. Very much appreciated. :)

Image
B
9
S
2
Posts: 111
Reputation: 1,010

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, duditon, Kermad, R0J0hound, yiuyiu6666 and 7 guests