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

Pages: 1 ... 3 4 5
Ask a Question / Re: Colliding With Actors/Swapping Bools
« on: November 14, 2018, 09:13:45 am »
I would try the following:
- Create a Boolean attribute for your player.
- Randomly assign a "True" or "False" to the attribute when the player is created.
- For your other actors, create a corresponding Boolean attribute.
- When the Actor collides with a member of the actors group, do two things: 1) set the Boolean attribute of "actor of the group" to the same value as the current value of the player's Boolean attribute (use block Behaviours --> Attributes --> "For Actor, set text to anything for behaviour" block), then 2) flip the current value of the player's Boolean attribute (i.e. if attribute is false, set it to true, otherwise set it to false).

This should work because as I understand collisions do not technically happen simultaneously but shortly after one another, so there will always be a flip in the middle.

If you have continuous collisions, the booleans would be constantly changing. If you need to avoid this and make sure the boolean for each actor is only set once, you can introduce a second Boolean for your actors, something like "Value assigned" (default = false). And then for the Collision event, do the following:
If [get the attribute Value assigned from the actor's behaviour] = false, [execute the transfer of the main boolean value from the player to the actor as described at the top of the comment], set the Value assigned in the actor's behaviour to true.

Not sure if this is what you're looking for though.

Hi, in my game I need to create "hit" (attack) object in front of my avatar.
To do this I first created the "Direction" game attribute (in settings, or the Violet blocks in the palette) and made sure the Direction attribute changes according to input from your movement controls. You can also simply use the "Point actor" block but for some reason it didn't work for all directions so I went with the game variable. (see x-movement, y-movement screenshots),
Then in the "Hitting" event I create the "Hit" actor at the avatar's coordinates plus (or minus) the tile width depending on the avatar's current Direction. Hope that helps!

Ask a Question / Re: Help with character movement
« on: November 14, 2018, 08:11:11 am »
- For the charging up part: did you experiment with multipliers or incremental additions? E.g. "If the mouse is down, set Speed to Speed x 1.005" or "If the mouse is down, set "Speed" to "Speed + 0.01" or something like that. This way it will automatically take many cycles to build up the speed to the desired level, and the charge-up will be more realistic.
- Also do you reset the Speed to zero / default value somehwere?
- As for going backwards, there are many ways of dealing with it. E.g. You can have a separate event that constantly checks if the velocity is positive, and resets it to zero if it goes below zero.  ("If Speed < 0, set Speed to 0"), or as Bombini says, add an "If > 0" check for the "decrement" block.

Extensions / Re: Artificial Intelligence Tools Extension (Beta Release 8)
« on: November 14, 2018, 07:57:33 am »
Thanks Robert, I updated the code in the .hx file but the game still crashes :(
I'll appreciate if you could take a look at the screenshots of my event code (I copied all screens that I think could be relevant):

I'm really puzzled by this error, because I execute your pathfinding AI code only if the "path_initiated" attribute is true (see "chasing the avatar p3" event), but the only setter of this boolean to "true" happens immediately after I define the start / finish rows and columns (see "chasing the avatar p2" event). So I'm wondering how the AI logic can run at all if the terminal nodes are not defined...

Extensions / Re: Artificial Intelligence Tools Extension (Beta Release 8)
« on: November 13, 2018, 05:58:39 pm »
Hi Robert,
The pathfinding AI works great, which helps my project tremendously!
Still, I found it can generate errors in my specific case.
As I understand, it has to do with my code rather than with your tool, but I'd appreciate any leads.
The bug seems to be triggered when my Avatar collides with the detection sensor and the NPC is itself collided with a tile at the same time, but I'm not entirely sure.
Here's the error message it generates (also see attached as a screenshot):

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at AStar$/bestPath()[C:\Users\Demid Tishin\AppData\Roaming\Stencyl\stencylworks\engine-extensions/ai-tools/AITools.hx:1291]
   at AITools$/findPath()[C:\Users\Demid Tishin\AppData\Roaming\Stencyl\stencylworks\engine-extensions/ai-tools/AITools.hx:196]
   at MethodInfo-6771()[Source/scripts/Design_9_9_NPChackandhug.hx:776]
   at com.stencyl.models::Actor/innerUpdate()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/models/Actor.hx:1530]
   at com.stencyl::Engine/update()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2479]
   at com.stencyl::Engine/postUpdate()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2618]
   at com.stencyl::Engine/onUpdate()[C:/Program Files (x86)/Stencyl/plaf/haxe/lib/stencyl/1,00/com/stencyl/Engine.hx:2611]

I tried running the game in the debug mode, but it constantly requests Visual Studio, which I already have (up-to-date version) so I have no clue how to debug it.
Here's the game project file if you'd like to take a quick look:
And here's a recorded video (the error message does not show on video since it's generated over the active Adobe Flash window)

Thank you very much!

Extensions / Re: Artificial Intelligence Tools Extension (Beta Release 8)
« on: November 09, 2018, 08:47:11 am »
Sorry for the false alarm, found a corresponding section of custom blocks now.

Extensions / Re: Artificial Intelligence Tools Extension (Beta Release 8)
« on: November 09, 2018, 08:33:41 am »
Hi, I've tried to install the AI Tools extension but it doesn't show up. I closed and re-opened the project (and Stencyl), no effect.
It does show under Setting > Extensions, but nowhere else (see attached screenshot).
I'm using the official Stencyl version from the Download page (3.4.0 beta 4, b9300, 2017-02-14).
Any leads? Will really appreciate any help. I'm making an RPG, and pathfinding is obviously a critical thing :) Thanks!

Dialog Extension / Re: How to Install for Stencyl 3.4
« on: October 25, 2018, 03:36:27 am »
Hi Justin, the URL ( says it can't load the page. Is the website temporarily down? Could you upload the files to a dropbox folder instead? Thanks a lot!

Thanks ariakbari, using game attributes actually worked!
And I created just one game attribute ("number" type, i.e. 0, 90, 180, 270 etc.) instead of 4 boolean attributes.
I think it's a lighter solution, and also in this case you can point your character diagonally when two controls are pressed at the same time. And there's no need to have extra lines of code that reset the booleans.
Still wondering why the standard "pointing" function didn't work properly...

Any ideas, anyone? I tried using custom boolean attributes (e.g. "facing left" = true) instead of the standard "direction of" / "point [actor] towards..." attribute but still the "Hit" actor is created only at 0 degrees and 270 degrees (i.e. on the right or above my avatar), but if it points to 90 or 180 degrees no "Hit" actor is created, even though the logic and syntax seem identical for all directions. What am I missing here?

Hi! It does fix the 2nd issue, but not the main one (no. 1) - the "hits" are created only on the right and above the actor, not below or left.

I'm trying to create "hits" ("hit" actors) in front of my avatar (emulating a melee strike) when I press Enter.
Running into two problems here:
1. Hits are created to the right of the avatar and above it, but they are not created on the left or below.
2. Hits are created next to the avatar only if the avatar stays within a small area of the scene. If the avatar moves outside this area, the "hit" actors are created not next to the avatar but inside that small area of the scene.
3. Additionally (unrelated to the "create actor" problem above: the avatar gets stuck within a small rectangular area of the scene if it goes to the bottom of the scene.
Screen recording here (60 seconds):
Thanks a lot!

Ask a Question / Re: Player actor stuck on screen edge - no X movement
« on: September 19, 2018, 08:00:40 am »
Thanks Jeffrey, I turned Debug Drawing on and saw a huge frame standing in front of my actor.
I clicked various view modes in the Scene editor and discovered a Terrain rectangle that was blocking the way. I've no idea how I put it there :) Deleting the terrain solved both issues!
Thanks again, Debug Drawing works miracles!

Ask a Question / [SOLVED] Player actor stuck on screen edge - no X movement
« on: September 18, 2018, 12:07:17 pm »
Hi, I've just started to learn Stencyl and ran into two problems:

1. When I set my player Actor Type movement to 'Normal', during simulation the actor automatically moves to the left edge of the screen and doesn't react to pressing 'left' or 'right' buttons. It does react to 'up' and 'down' buttons though. If I change the Actor Type to 'Cannot Be Pushed', it reacts to all 4 direction buttons (but then collisions don't work).
I've searched the forum, crash course 2 and the stencylopedia but still at a loss.

2. The actor doesn't stay within screen boundaries even though I made it check coordinates.
Any suggestions, especially to the first one?  Thanks

Pages: 1 ... 3 4 5