Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - captaincomic

Pages: 1 ... 237 238 239 240 241
Put only the "set font to"-block in the "if Font has value"-block, all the other blocks wouldn't be inside the if block.
Not setting the font is the same as using the default font.

So if the Font attribute is not null, you set the font with the "set font to"-block.
But if the Font attribute is null, you don't set the font to anything (i.e. use the default font).
Then you do the drawing, and you can use "get height/get width"-blocks. (at least it works for me)

Ask a Question / Re: Apply effects to an entire scene?
« on: December 11, 2011, 03:21:00 pm »
If you don't want to do it yourself, I did the BlurFilter thing, you can find it on StencylForge in Eye Candy Pack (or Eye Candy Pack Showcase), the behavior is called Screen Blur.

EDIT: but note that if you apply it every frame your FPS might drop quite a bit

Hmmm, I'm confused, maybe there is more than one issues here.
One thing I can say for sure now: "Default Font" means that the attribute is null.
So whenever you use a font attribute it's probably a good idea to check if it's not null.

Does it help if you put your "set font to Font"-block in a "if Font has value"-block?

Ask a Question / Re: Multiple behaviour instances
« on: December 11, 2011, 01:41:20 pm »
I too would like to add a behavior more than once to an actor sometimes.

For example I have have a "Do on Key Press"-behavior that sends a message using the "tell self to _ for all behaviors" when a key is pressed.
Let's say my spaceship fires a bullet when A is pressed and activates the shield with S is pressed. I would make sense to have the "Do on Key Press" attached twice to the spaceship, once for A, and once for S.

So whenever you have a behavior that can be modified with attributes, it can make sense to have two instances of it for the same actor.

I had the same error messages before. Are you sure it is the 'get height for current font' etc functions that throw the error? I thought that the error comes from using the "set current font to" with a null-attribute.

The code in the attachment seems to work fine for me (for default font and for custom font alike).

But I would consider it a bug that setting the font to "default font" throws an error unless you check if font is not null. Apperently selecting "default font" means the attribute is null, so setting the font to null should be just ignored, instead of raising an error.

Paid Work / Re: I really need a simple gun firing behavior.
« on: December 02, 2011, 02:31:33 am »
Also, on stencylforge there is an resoucre pack called "Action Pack". It contains behaviors "Do on Key Press" and "Fire Cannon". Maybe that helps.

Old Bugs (1.x/2.x) / Trigonometric Function Documentation
« on: December 01, 2011, 05:03:20 am »
The trigonometric function sin/cos/... take radians as parameter.
In the help section it says nothing about it, but gives a misleading example using degrees.

Ask a Question / Re: Local var
« on: December 01, 2011, 01:12:24 am »
If you want to use only blocks, you'll have to use regular attribute
and make it hidden.

I think of it like this:
hidden attribute = local variable
non-hidden attribute = parameter of behavior

Paid Work / Re: List of actors within a range of other actor
« on: December 01, 2011, 01:05:18 am »
I see you use a different method in that post, Hectate: create a circular region around the actor and set the region to follow him, and then use the "for each actor within region"-block.

I wonder though which method would be faster? After all stencyl has to check somehow which actors are inside the region. I guess if you need the distance anyway, its easier (and maybe even faster) to check manually if distance < range (or alternatively distance^2 < range^2).

Paid Work / Re: List of actors within a range of other actor
« on: December 01, 2011, 12:47:46 am »
About getting x and y of actor B in behavior of A:
When you have the "for each actor of type"-block you can use the "the actor"-block (in the palette below the "for each actor of type"-block).
So "self" would be actor A and "the actor" would be actor B (you can drag "the actor" over the "self" dropdown list for the "x of self"-block.

Paid Work / Re: List of actors within a range of other actor
« on: November 30, 2011, 08:19:26 am »
Yes, good point. When you skip the square root, use (desired range)^2 to determinde if an actor is within range.

Paid Work / Re: List of actors within a range of other actor
« on: November 30, 2011, 07:34:59 am »
The distance between two actors is
sqrt(((x of actor A)-(x of actor B))^2 + (y of actor A)-(y of actor B))^2

You can use a "for each actor of type B"-block and calculate the distance between A and each actor of type B. If the distance is lower than your disired range then the actor is in range and you can do something with it or set an attribute "is within range".

Ask a Question / Re: Centrifugal Force in a game???
« on: November 30, 2011, 02:45:32 am »
You have an object rotating around your tonado. When you "let go" of a it, it moves along the tagent at his current speed.

So I see two ways you could do this:
1) Using forces. To rotate the object you need two forces, one that pushes the object in any direction, and the Centripetal force that pulls the object towards the center of the tornado. (The Centrifugal force is only observed if you are within the rotating system, you don't need it.)
You need to set the Centripetal force to the right amount so that the object really rotates.
Then when you let go, just turn off the Centripetal force, and the object will fly away.

2) Ignore forces, use speed. Caculate the x/y speed for the rotation, when you let go, calculate the direction of the tangent and the current velocity (=sqrt(x-speed^2+y-speed^2) and set the velocity for the object to these results.

Not sure what would be easier.

Ask a Question / Re: Recycle when Off Screen Problem
« on: November 29, 2011, 02:19:44 pm »
No, the offscreen bounds work fine. It's true, setting the offscreen bounds to something bigger than your biggest actor would help. I didn't think about that. I just thought checking if the actor is completly offscreen would be more straightforward.

Archives / Re: Add block to get linear velocity of actor
« on: November 29, 2011, 02:12:09 pm »
I was also wondering why there is no such block. To get the linear velocity use pythagoras' theorem: sqrt(x-speed^2 + y-speed^2). Still would be nice if stencyl wrap this in a block...

Quote from: Epic428
There's a Block for that.
Nope, not this time :)

Pages: 1 ... 237 238 239 240 241