[quote="eski":1gjnzkov]1. I'm trying to code this so i can only select one item at a time, basicly only shoot one item and when it has stopped you can shoot another. I have tried to have loop, for each, always and all, just cant get it to work.[/quote:1gjnzkov]
The easiest way is to click the mouse to choose a piece, then release the mouse to shoot it. You can still cancel with right-click this way.
What's happening is that your Click triggers are both triggering at once, that's why you're choosing more than one piece at a time.
[quote="eski":1gjnzkov]2. I'm trying to make the line be maximum length off 300 pixels. [/quote:1gjnzkov]
You can do this with clamp(). Clamp restricts a number between two other numbers. Like so:
clamp(target value [this is the actual mouse distance], minimum value [this is the lowest the width should be], maximum value [this is the longest it should be])
Abbreviated: clamp(target, min, max)
The easiest way to make your line stop at 300 pixels is by using the sprite object, because you can easily set the width. I changed it to sprite object and did the following:
Set width to: clamp(distance(line.x, line.y, mouseX, mouseY) - 5, 10, 290)
I set the target to mouse-distance-minus-5 so that the edge of the sprite wouldn't poke out past the point of the arrowhead. The min length is 10, and the max length is 290 instead of 300, again so the end won't poke out past the arrowhead.
Setting the arrowhead distance and position is a bit trickier. You basically have to orbit it around the line object's x and y. I used cos and sin to find the position:
Set angle to: angle(line.x, line.y, mousex, mousey)
Set X to: line.x+cos(Sprite3.angle)*clamp(distance(line.x, line.y, mouseX, mouseY), 10, 300)
Set Y to: line.y+sin(Sprite3.angle)*clamp(distance(line.x, line.y, mouseX, mouseY), 10, 300)
You may be able to use the Orbiter or Custom Movement behavior for that instead, if you don't like math. I just happened to have the orbit expression laying around from another project and I reused it.
The Custom Movement behavior has actions that will restrict the distance an object is from a point though, so it shouldn't be too hard to figure out.
[quote="eski":1gjnzkov]3. There are two "teams" blue and red. Its the same sprite, blue is one animation and red is another. So basicly i just change the animation. Ok so i'm trying to make a textbox in the corner count the total of each team. I have tried to use AV 0 for blue and 1 for red and used a event like this
Sprite Value Team Equal 0
- Set text to Sprite.Count
Should this not work right, it gives me the total, counts the blue and red.[/quote:1gjnzkov]
Apparently .Count isn't respecting the Selected Object List. You can get around that by using a For Each loop and picking the sprites by their Team value. Example in the .cap below.
[quote="eski":1gjnzkov]Can i Spread Values in AV on Instances to know them from each other ? Like puting ID's on them.
Can Sprites have transistions when creating and destroying ? (or do i have to program them like fading)[/quote:1gjnzkov]
You don't need to spread values in Construct. The picking system generally knows what you're talking about as long as you keep your conditions straight. On the off chance you come across a situation that doesn't pick what you want, try a For Each coupled with the condition you're using to pick with.
As for sprite transitions, you pretty much have to make your own. There is a Fade behavior you can put on your sprites that might help you out, but the way you're doing it now is pretty much right on the money.
Anyway, here's the .cap with the changes I made. I didn't comment anything though so if you have any questions about what I did feel free to ask.http://dl.dropbox.com/u/529356/shuffleboardThing.cap