### 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.

### Topics - froz

Pages: 1
1
##### Ask a Question / Changing actor position via scene behaviour reset speed of the actor
« on: July 12, 2013, 03:05:52 pm »
Hello,

Some time ago I have returned to stencyl and I'm working on a new project. I have stumbled across a problem that I don't understand. I probably can (and probably will have to) make a workaround, but first I would like to understand why things aren't working the way I think they should.

Here is what I want to accomplish - this is a top-down game about ships, regular battle "map" is just a sea that I want to be quasi infinite in all directions.

So, what I did:
- I created quite big scene (3 screens wide square).
- camera is following the player's ship
- when player's ship is 1 screen-distance to any edge, all actors (of the group "actors") are moved 1 screen-distance in the opposite direction (it happens through scene behaviour). Later on I would make sure actors that are outside of the scene would be killed/recycled now.
- it seems to work well, actors are moved like they should, however they loose their velocity - their x and y speed is set to 0. I'm not sure, but I guess it may be a normal behaviour when you use "set x/y" block.
- I tried to fix this by adding a code that runs in the same loop "for each actor of group actors" where I change x/y position of those actors. The new code first remembers x and y speed of an actor, then apply set x/y blocks, then set x/y speed to what it remembered.

It doesn't change a thing.

After more research with some print blocks I have found out that in fact speed is not reset just after changing x/y position - it happens on the next frame. What is the most strange for me is that it looks like while normally in each frame scene behaviour and actors behaviours act one after another, when I'm moving the actors via scene behaviour, the actor behaviour is not executed this frame. It looks like this:

Starting game
scene behaviour execution
actor behaviour execution
...
scene behaviour execution
actor behaviour execution
scene behaviour execution - here I move actors, at the end of this frame actors' speed is not reset
scene behaviour execution - at the beggining of this frame actors' speed is 0.

I'm thinking of a workaround now - save x and y speeds of each actor in a table(s) in the scene behaviour before changing their positions, then at the beggining of the next frame set x/y speed of each actor according to the tables (I hope the order of actors in "for each actor" loop is always the same). Before I try that I would still want to know why the thing that happens, happens and maybe what am I doing wrong.

Also, if you think my approach to the problem of "invite" sea is wrong, tell me how else I could do it .

2
##### Resolved Questions / [RESOLVED]List inside list problem
« on: October 19, 2012, 10:02:30 am »
Sorry for very general topic name, I couldn't find better one.

I have a problem/question concerning lists. I have a code similar to this:

Code: [Select]
`set listA to create new listset listB to create new listset listB to split [2,2,0,-1] using separator [,]print listAreplace item #2 with -1 in listBadd listB to listAprint listAreplace item #2 with 1 in listBprint listAempty listBprint listA`
Now, I was pretty sure that this code should print this result:

Code: [Select]
`2,2,0,-12,2,0,-1,2,2,-1,-12,2,0,-1,2,2,-1,-1,2,2,1,-12,2,0,-1,2,2,-1,-1,2,2,1,-1`
However, I get this:

Code: [Select]
`2,2,0,-12,2,-1,-1,2,2,-1,-12,2,1,-1,2,2,1,-1,2,2,1,-1,,`
Can anyone explain to me why does it happen? Why are items in listA affected by changes to listB that were made after listB was put in listA. I thought that when you put an item in a list, you don't really put the attribute itself there, but only the value of that attribute. So when you change the attribute later, it won't change the value inside the list. And I have pages of code that work like this. But not in this case.

Edit: Just after finishing this post I checked something. Using "set listB" kind of fix this. I mean this block will change listB, but will not change any item in listA, while "replace item x in listB" and "empty listB" will change items already saved in listA. I really don't get it.

3
##### Ask a Question / Custom blocks editing
« on: June 22, 2012, 05:20:37 am »
Is it possible to edit custom blocks and not just change their name, but also change and add/delete block fields and return type?

When I edit the block from pallete (right click on the block, btw it's very counterintuitive) it lets me change only it's name, description and "block spec" fields.

Do I really have to remake a custom block when I realize I made a mistake or when I want to change it and take more attributes? I have already done that few times, but now I have this custom block which is quite big, it has 4 block fields (not including self) and I want to add one more.

4
##### Ask a Question / Why can direction of self be over 360?
« on: June 16, 2012, 02:48:29 pm »
Hi there,

the subject says it all. I don't understand why the direction of an actor is not like any other angle, told with a number of degrees from -180 to 180, but instead it appears in can be any number. For example if I turn my actor in game clockwise, after reaching 180 it won't switch to -179, but it will be 181. Later it can be over 360 and more. It's really frustrating and I wish I would notice it earlier. Any reason why it works like this?

Is there any better workaround to get direction degrees in range of (almost) -180 to 180 then get reminder of direction/360 and check if it's more then 180, if it is, decrement it by 360?

Thanks for help.

5
##### Archives / Many attributes - sorting, search function and better dropdown for some blocks
« on: June 07, 2012, 06:04:30 pm »
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.

6
##### Resolved Questions / [SOLVED] Calculating angle between 2 directions from actor
« on: June 01, 2012, 02:13:13 am »
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