Just need to know for a small adjustment in my project, how do I get my coin to stop pointing towards the mouse pointer when its left the coin shooter.
So far I've got for the coin:
Forever if <touching (shooter 1)>
point towards (mouse-pointer|)
And for the shooter:
Forever if <touching (Coin 1)>
point towards (mouse-pointer|)
How can I get the coin to stop pointing towards the mouse pointer (and the shooter if possible) to stop pointing towards me when they aren't touching each other. (Think they keep pointing even when not touching because of 'forever if' block?)
Offline
Please Help! This has to be in later today!
Offline
bump
Offline
DoowNimajneb, in future, please keep questions about a single project on one thread rather than creating a new one for every question you have!
(It might also help not to leave the project to the last minute, though I do that too, I'm not gonna berate you.)
you're using forever if rather than forever and if, that's the problem here. You put:
forever if <touching [shooter1 v]?> point towards [mouse-pointer v] end forever if <touching [coin1 v]?> point towards [mouse-pointer v] endWhat you're after is this:
forever if <touching [shooter1 v]?> point towards [mouse-pointer v] end end forever if <touching [coin1 v]?> point towards [mouse-pointer v] end endThe forever if block will repeat its contents for ever if the statement is true the first time it checks. Since your coin starts out touching the cannon it will always point towards it. By putting a if statement inside a forever statement, you can get it to check forever and respond appropriately.
Offline
But wait,you can't stack forever blocks
Offline
sparks wrote:
DoowNimajneb, in future, please keep questions about a single project on one thread rather than creating a new one for every question you have!
(It might also help not to leave the project to the last minute, though I do that too, I'm not gonna berate you.)
you're using forever if rather than forever and if, that's the problem here. You put:forever if <touching [shooter1 v]?> point towards [mouse-pointer v] end forever if <touching [coin1 v]?> point towards [mouse-pointer v] endWhat you're after is this:forever if <touching [shooter1 v]?> point towards [mouse-pointer v] end end forever if <touching [coin1 v]?> point towards [mouse-pointer v] end endThe forever if block will repeat its contents for ever if the statement is true the first time it checks. Since your coin starts out touching the cannon it will always point towards it. By putting a if statement inside a forever statement, you can get it to check forever and respond appropriately.
I'm afraid you're wrong for once, sparks.
The forever if and the forever - if work exactly in the same way!
If in doubt, try
forever if <key [space v] pressed?> move (1) steps endand
forever if <key [space v] pressed?> move (1) steps end endThey do the same thing and stop when you don't press space!
Offline
You, my friend, should do this:
COIN:
when gf clicked forever point in direction ([direction v] of [cannon v]) end
when i receive [fire v] repeat until <touching [edge v]?> //If it has hit something... move (4) steps endCANNON:
when gf clicked forever wait until <not <mouse down?>> repeat until <mouse down?> point towards [mouse-pointer v] end broadcast [fire v] and wait end
Last edited by SciTecCf (2012-07-16 06:01:44)
Offline
Hi SciTef, how do you set it to point in the direction of wherever the cannon is pointing?
Offline
You can find the [direction v] of [sprite v] block in the sensing section. By default, the variable that shows up is [x position v] but you can select others (including any variables you've created that are local to that sprite).
point in direction ([direction v] of [cannon v])
Last edited by amcerbu (2012-07-16 17:30:49)
Offline
Now for some reason, the coin isn't even pointing in the same direction as the coin shooter even when I want it to! Please Help! I will post this glitchy project if I have to, just please help me!
Offline
Ok, I'll post it under the name: Roll 'em in - Teaser
Offline
sorry, I just realised, I'll have to do it tomorrow, but I can do it at 6' O 'clock but then I'll need an answer for my problem the same day as this project is due in on thursday...
Offline
Right, just posted, should be online in under 1/4 of an hour... Please help solve my glitches! I named the project: Roll 'em in - Teaser
Offline
please help my project
Offline