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 - froz

Pages: 1 ... 15 16 17
241
Ask a Question / Re: Damping with no gravity or any other forces
« on: June 09, 2012, 02:19:33 am »
How exactly do you do this? Simple set x speed to x-speed * 3/4 and same with y-speed should work.
If you use it in update event, your objects will slow down (1/4 of their speed every frame, this is very, very fast, they will almost instantly stop).

242
Ask a Question / Re: Trouble with Attributes
« on: June 09, 2012, 01:55:03 am »
When you have problems like this, use block "print" to check if the code is being run like you think it is. For example, you can add at the beggining of when updated event: "print right as a text", then start the game, open console and see if it shows left after you pressed left. If it is still printing "false", then you know this part of your code works well and something must be wrong later. Remember to delete or deactivate print block afterwards, or it can really slow your game down.

243
Resolved Questions / Re: Displaying text when player goes near object
« on: June 09, 2012, 01:30:27 am »
Quote
I wanted to to it by region control at first, but couldn't really figure out how to do so. I'm pretty sure its done through the "when actor enters/exits region" but when I try to use that, I can either choose for the region space "last created region" or a region attribute. Choosing "last created region" doesn't seem to do anything, whereas I know how to create a region attribute, but not how to correlate that attribute with the region in the scene. For instance, if I have a region called "Region 1" how can I set the rule to apply when the player enters region 1?
Make an attribute of region type and set it to the last created region in the event where you create that region, just after that. Later use that attribute in the when actor enters/exits region (or better "when actor of type enters exits region", so you can choose your player's type). It should work.

Method posted solleader would require separate graphic for every text, I wouldn't do it.

Sift's method can be good too, although I would change a bit:

Code: [Select]
if ((absolute value of (x of self - x of player) < distance to show text) and (absolute value of (y of self - y of player) < distance to show text))
set show text? to true

and in the draw event
if show text?
switch to screen space
draw text blabla at x something y something

However, this would require you to let the item somehow know which actor is your player.
You should also consider what will happen if you have 2 items close to each other and player would trigger behaviours to show text for both items in the same time.

244
Resolved Questions / Re: Displaying text when player goes near object
« on: June 08, 2012, 09:58:02 am »
Everything always is drawn at x/y relative to the actor to which the behaviour is attached. So for example if you draw at 100,100 and your actor is at 100,100, the drawing/text will appear at 200,200. That's probably why you didn't see the text before. You can change it by using "switch to screen space" block. So you can keep the behaviour attached to the actor and don't have to move it to the scene.

I haven't done anything like this really, but instead using collisions, I would create a region in the item (f.e. bookshelf) actor behaviour, a region little bigger then the actor itself. Then I would use "when actor enters/exits region" to show/hide text.

This way it will also be much simpler to create different texts for different items.

245
Ask a Question / Re: Need a way to program this.
« on: June 08, 2012, 01:42:46 am »
Check if you don't set enemies counter to 0 somewhere (f.e. in always event in any behaviour or in "when creating" event for behaviours of actors that are created during gameplay).



I also suggest that you change "create actor" to "create recycled actor" for enemies and "kill actor" to "recycle actor". It's made for cases like this one, when you create many identical actors, kill them and create more. It will make game use less resources (otherwise it may get laggy on slower PC with many enemy actors alive).

246
I have quite a long list of attributes in one of my behaviours and the list may grow even bigger. It started to be hard keeping it clean, especially after I change some parts of code.

Maybe I'm missing some feature, in such case I hope you can enlighten me :). I tried

Otherwise, here is my ideas. It would be far easier if I could:
1) sort the attributes list (by name, by type and by hidden/not hidden columns)
2) search for all blocks that use given attribute (I imagine it would be under right click, then some buttons for next and previous block, as well as information on how many blocks use the attribute). What I do sometimes is that I copy some code blocks from one behaviour to another. Stencyl is nice and it copy all attributes that it didn'g find in the second behaviour. However, usually after copying I change the copied part, removing the need for some attributes. Sometimes it's hard to find if I can safely delete an attribute or is it used by another part of the behaviour.

I have another issue - some blocks have a simple dropdown list where you have to choose an attribute (f.e. "increment/decrement value" and "get attribute from another behaviour" blocks). With too many attributes the list is missing some of them (it stretches from the top to the bottom of my screen and the last visible attribute text has it's lower half cut by the screen edge, I have checked it and I'm sure there are attributes not visible on the list).

Solution is simple - make the dropdown list automagically create second column if necessary. Also - sort the list alphabetically.

Similar sorting problem is with the list showing up when you click on any empty space in most code blocks (for example 0+0 block) and choose  attributes. They all show up (strange though that there are 2 neat columns, then the rest is placed randomly in the next 8 columns with most of the space not used), but they are not sorted in any way (they should be sorted like in the palette, by the type, then by the alphabet).


You may wonder why am I using that many attributes and do I really need that many. Well, I'm trying to create kind of strategy game and it just needs that many attributes :]. I'm already restraining myself and reusing attributes when I can.

247
Archives / Re: Searched blocks have a "find here" bubble
« on: June 07, 2012, 05:34:49 pm »
Blocks not available in the event you are editing won't show up in palette, but will show up when searched. AFAIK that's everything in draw section (when not in "when drawing" event) and collision section (when not in "collisions" event).

248
Quote
Hmm... on second thought... new proposition. If the player had an actor attribute Target, and I set Target to be Enemy1, would I have access to all attributes of Enemy1 through the Target attribute? Something along the lines of "Player.getTarget().getWeakToFire()."

Creating attribute Target and set it to enemy actor should do the work, I'm doing something similar in my project.

Then just use "for Target get _WeakToFire from behaviour whateveritis". Stencyl is so polite that you don't have to remember internal name, just choose from the dropdown list (attribute names).

You need Target attribute anyway to apply damage to the enemy, don't you?

I would not do it via Game Attributes, I believe it could get very messy very quickly, especially if you have more attributes you would need to check.

249
Thank you so much. It is exactly what I needed and it seems to be working well. I'm not 100% sure because I have to fix something else first to check it live in my game.
I was thinking that some ifs could be the way to do it, but I couldn't figure out such an elegant solution and I didn't want to create 10 ifs just for that. Thanks again.

250
Hello,

First of all, I'm new to Stencyl, but I have to say that I love it. It's so easy to understand, so easy to experiment with it, really great program.

I have a problem with some trygonometry though. Let me say what I have and what I want to get.

I have 2 angles and I want to determine the shorter angle that is between them. Or let me say that in other words - I have 2 directions from the actor and I want to know wheter first direction is closer clockwise or counterclockwise to the second direction.

For example direction A is 170 degrees, directon B is -170 degrees. The shorter angle between them is 20 degrees, counterclockwise from A. How can I calculate it?

Thanks for any help.

Pages: 1 ... 15 16 17