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

Pages: 1 2 3
Ask a Question / Re: Detect if actor exited region, from list of regions
« on: October 18, 2018, 10:15:39 pm »
I think I see what's going on now. I was imagining a different scenario, but you want to kill the walls when the WhiteBall4 leaves a region?

One thing you can do is set up a behavior, attached to the ball, that contains two attributes: "Current Region" and "Current Region Temp"

In an "always" event, set up the following code

Code: [Select]
On Update:
    set Current Region to Current Region Temp
    set Current Region Temp to the region the ball is in
    check the state of the two booleans and react accordingly

There are two states you'll want to check for and write code to react to:

Current Region == Current Region Temp: The ball has not moved from one region to another

Current Region =/= Current Region Temp: The ball has moved. Current Region will be the region the ball is moving out of, and Current Region Temp will be the region the ball is moving into. This state will only be held for one engine step and so will execute only once each time the ball changes regions.

Awesome. For now I went ahead and just put the code in the "if WhiteBall4 is inside item" bracket so I could easily reference my list in that scene. I wasn't sure how to reference my local attribute list from the scene in the actor behavior...

Regardless, where I have it it's working great so far. Only issue I notice is if my player comes to a stop and he is overlapping two regions, no walls are created around me. In my "created" code you can see the positions of my regions, so for example if my actor's x-center is 150, he is in two regions, overlapping... When he is like this, in two at a time, none of my walls are created. Not sure if this attributed to placing the code where I did as opposed to as a behavior. Let me know if there is a fix. Besides that it's working flawless. Thanks a ton for the help.

Ask a Question / Re: Detect if actor exited region, from list of regions
« on: October 17, 2018, 11:35:03 pm »
If I could see more of your code then I could better explain how you might integrate my idea with what you currently have. There are several ways to accomplish this, but I bet there's one way that would minimize how much of your current code you'd have to rework.

Attached. Let me know if more is needed, this should be sufficient.

1st screenshot is in updating event. "Pre Point" is the angle my character is facing. I find the pre point values for 4 sets of angles, in hand one actor (wall) created for each set. You can see the second set of angles with 45 and -45 at the Bottom.  I only ever have one of the walls active at a time. This happens in each region.

As you can see, when of these 4  "pre point" values become true, aka my actor facing one of 4 ways, I kill all other walls (so I am keeping one active always) and create one the direction I'm facing.  So if I'm facing up, I have a wall above me, I spin 90 degrees clockwise, that wall is killed and now I have one to my right. All this works great.

But if I am in one of my regions, facing upwards let's say, and exit the region, still facing up, since I didn't change my direction the wall is not killed. For this reason, I need to be able to kill these actors when I exit the region.

I also attached some of the regions being made and added to my list in my created event.

Ask a Question / Re: Detect if actor exited region, from list of regions
« on: October 17, 2018, 10:24:52 pm »
One thing you could do is store the region the actor is created in as an actor value. When the player exits a region, loop through all of the actors and kill the ones which are flagged as belonging to the stored region.

Thanks for the reply. I'm not 100% sure I follow you here. So store the region (current "item" the actor is in) as an actor attribute?

Then which blocks shall I use for when the player exits a region? The "when player exits region event" and set one for each region ? Seems like the only option but I would have to make quite a few to account for every region... not sure this is what you mean.

I think I'm just missing you entirely... I've read what you said a couple times and am not sure how to execute that. If you have a chance to clarify my confusion I'd love to hear and hopefully get this worked out. Thanks

Ask a Question / Re: Mouse Rotation?
« on: October 17, 2018, 08:25:54 pm »
I believe it is -

set (x) to (X of mouse) - (X-center of self)
set (y) to (Y of mouse) - (Y-center of self)
set (direction) to atan2 y: (y) x: (x) as degrees
point self towards (direction) degrees

x, y, and direction all being number attributes

Ask a Question / Detect if actor exited region, from list of regions
« on: October 17, 2018, 08:13:14 pm »

In my game, at the start I am creating several regions and adding each to a list, "list1". Using the blocks shown in the attachment, I am able to successfully create things in each region once the actor enters that specific region. Perfect so far.

Now, when my actor enters each region and I create some things, I want to be able to kill these things being created from the region the actor was just in ("item"), once he exits that region. Doesn't seem too sophisticated, but I'm new-ish to lists and not sure how to go about this, as there is only an "if actor is inside region" block and nothing of the sorts for an exit block...

There is the event you can create "if actor exits region" but I wouldn't be able to call on a list from there I don't believe. Doing one of these for each region would not be useful, as I have tons of regions. Simply using "not (actor is inside region)" does not work either, as this just cancels all actions all together and doesn't allow my actor to create anything. Lastly, I tried doing an if statement for my actor exiting each side of the region, "if (x of actor) > x of (item)" "if (y of actor) > y of (item)" etc. but that also cancelled out my actions being performed in the first place. I didn't figure either of these would be the way to go about it as I could see how they would screw things up, but I figured it was worth a shot. No luck so far.

So basically- Any good way for me to kill everything I just created in a region upon exiting that region, while using "for each"?

I would be happy to post more of my code if that helps. I'm also glad to go into further detail if needed. Any help is appreciated. Thanks!

Extensions / Re: Some sort of zooming extension
« on: October 16, 2018, 05:21:09 pm »
Sorry to bring this topic back from so long ago, but I felt posting this as a whole new topic might not be of much use...

Trying to use this extension in 3.5, I got quite a few errors initially and have solved most of them except this one. I tried a couple things to no avail. Any clue? If you happen to know what I can do about this I'd love to solve it. I do understand though this wasn't meant for 3.5, so if it's an unfixable issue or anything then so be it. Just hoping to implement this sweet extension. Thanks!


[haxelib] /Users/ariakbari/stencylworks/engine-extensions/Zooming Utilities/Zoom.hx:150: characters 2-24 : has no field canvas

Ask a Question / Re: How to make Flappy Bird
« on: October 14, 2018, 03:36:16 pm »
Just search "Flappy Bird" on StencylForge

Ask a Question / Re: Setting collisions with the image API
« on: October 12, 2018, 07:18:58 pm »
Just put this together, it's working for me currently. Let me know if there's a better way for it to be done. This seems to function fine though for what I just explained. Thank you for the help! All collisions are being picked up and it works flawlessly! Had no clue you were able to point to color value like that.

Ask a Question / Re: Setting collisions with the image API
« on: October 12, 2018, 07:00:02 pm »
Collisions with the image API are pretty simple. Just say:

if (get pixel x: y: of image)  = 16711680
    set velocity to 0
    set onground to true

16711680 is red. You would have have to figure out whatever color value you want to count as the colliding part. The x and y in the image is wherever your character is that you want colliding.


I just saw this, thanks for the help. I've got the color value for the parts I want my character to be colliding off of. In my case, my character is a ball bouncing off walls in all different directions in a maze. How can I set his velocity/speed to have him properly bounce off each wall upon collision? Setting velocity to 0 he will just stop on collision.

Like if right side of character hits a wall, set x-speed to negate absolute value of (x speed of character). Thus bouncing in opposite direction. Any way to do this for each collision with the image? Using the right side left side hit blocks won't work...

Let me know, thanks. Can explain better if needed.

Ask a Question / Re: Setting collisions with the image API
« on: October 10, 2018, 07:19:49 pm »
Thank you very much, I'll try each as a background and see what the impact is. I'll make sure to uncheck unneeded scales as well. Much appreciated.

Ask a Question / Re: Setting collisions with the image API
« on: October 10, 2018, 07:02:14 pm »
If you are creating everything with blocks, then I'm afraid there is no easy way to make them show in the scene designer. But you can work around this, just need some extra effort. Some ideas, since I don't know your exact setup:

If your final image is the same size as the scene, you can in photoshop pinpoint the spots where you'd need the terrains, with their dimensions and positions (remember that the top left corner is x: 0, y:0), assuming you have the full image in photoshop. You can set a terrain/region's position and dimensions precisely in the Inspector tab inside the scene designer, so that should be doable.

If you don't have a mock up, and your images are individual pieces, you could test game, your behaviors would assemble the full image, and you could screenshot the whole thing and stitch it together, then do the above process.

Another idea, unrelated with terrains, are the blocks under Actor> Properties > Collision Shapes. You could have an actor created at the position of every one of your image instances that would have a collision, and setup a collision shape to match the image's position and dimensions. I've never used them though, so I don't know if that would suit your needs.

EDIT: And of course, you can create the terrain regions with code blocks, or there might be an extension for terrain blocks in the forums.

Thank you, this is very helpful. Your first suggestion sounds the most suitable for me. I appreciate all the help.

 One last question- Since I have to do it many times over and over, I'm considering simply using the maze images from photoshop as a background in the scene allowing me to see it in scene designer. Then be able to place the custom terrain boxes from there. Is using image instances as opposed to a background per scene going to be significantly less impactful on my game performance/size?

Nice. Number attribute is definitely the way to go, didn't even think about that. Glad I could help.

Ask a Question / Re: Setting collisions with the image API
« on: October 10, 2018, 05:18:31 pm »
I recommend looking into using Terrain Regions before attempting collision with images. They are regions with solid collisions, so you could place them on your scene to make the collisions for walls in your mazes.

Got it. Considering I am creating each maze via image instances though, my maze is not present in the scene designer. Is there a way for it to be, so I can easily add custom terrain where I need? I see a "create region" block as well, but it seems that's different than terrain so not sure if I could use that. 

How else am I able to easily add terrain regions to the correct spots? I'm used to attaching image instances to an actor and in doing that they are not shown in the scene designer. Better way to create image instances to allow this?

Thanks for the help.

Ask a Question / [SOLVED] Setting collisions with the image API
« on: October 10, 2018, 04:01:05 pm »

I've nailed a few solid mechanics down in my current game and am now looking to correctly manage my scenes. Each scene is 3200 x 2400 (it's my understanding scene size doesn't effect game performance much, more what's going on in the scene) as I would like the scene to hold a maze that the player must shoot a ball through. I would like to have multiple levels in the game, so therefore multiple scenes around this same size. My Screen size is 320 x 480.

My problem is, drafting up a 3200 x 2400 maze in photoshop with lines running all over won't be doable when trying to place it as an actor. Nonetheless one of them per level. I've used image instances before and assume this is the route, but I am unfamiliar with it's capability with collisions.

If I place these 3200 x 2400 image instances in each of my scenes is there a way for me to set up collisions allowing the ball to bounce off walls correctly and what not? I am of course familiar with collisions with actors, and had my character bouncing perfectly off walls on a smaller scale, I'm just not sure how it works with the image API. I assume possibly something with the "get pixel" block? I tried a few things to no avail.

Any and all help is appreciated. Will gladly go into further detail if needed. Thanks!

I would try saving attributes for all of your player movements. Game attributes. Like

"If (up is down)
 set (UpMovement?) to true"

"If (right is down)
set (RightMovement?) to true"

do one for each, left, right, up, down.

Then instead of direction, try calling on those attributes to place the hits accordingly.

"If (UpMovement?)" or "If (LeftMovement?) etc. instead of "if direction of self=..."

Then so on and so forth use your code to place the hits as you've done. Make sure you are turning off each boolean appropriately as well. This may not fix the issue but this is what I would try as I've never used those direction blocks unless it's an image instance, I'm not sure how great those are. Not too sure about last issue. Set player to always active if he's not

Pages: 1 2 3