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

Pages: 1 2 3 ... 133
1
Ask a Question / Re: Actor steps on button
« on: Yesterday at 08:02:09 pm »
If the collision box of the button is the same for both animations then you shouldn't have that cycling problem. If you can't do that then you'll need to insert some kind of timer.

Code: [Select]
When creating
    Set 'is delayed' to false

When updating
    if 'is touching' is true and 'is touching temp' is false then
        //do whatever you want//
    end if
    Set 'is touching' to 'is touching temp'
    if NOT 'is delayed' then
        Set 'is touching temp' to false
    end if

When colliding
    Set 'is touching temp' to true
    if 'is touching' is false then
        //do whatever you want. code here will only execute once--
          the one frame for which both 'is touching temp' is true and 'is touching' is false//
    end if
    if NOT 'is delayed' then
        set 'is delayed' to true
        do after # seconds
            set 'is delayed' to false
        end do
    end if

2
Ask a Question / Re: Actor steps on button
« on: Yesterday at 11:46:21 am »
...how can I make the door close again when my actor walks away from the button? How can I make the game detect it? Because there's no block that says "when this actor stops colliding with this other actor". That's what I want to know. I thought I had fixed it with the X and Y stuff I said in my previous reply, but there are still things that remain wrong.
So could you tell me?

You can modify my code to detect the one frame for which 'is touching temp' is false but 'is touching' is still true. This should only trigger on the second frame after the player leaves the button. The first frame for which the player is not on the button, 'is touching' is still true and 'is touching temp' will be set to false. On the second frame, 'is touching' will "catch up" to the value of 'is touching temp' and both booleans will be false, hence the code is only executed one time without resetting the button.

Code: [Select]
When updating
    if 'is touching' is true and 'is touching temp' is false then
        //do whatever you want//
    end if
    Set 'is touching' to 'is touching temp'
    Set 'is touching temp' to false

When colliding
    Set 'is touching temp' to true
    if 'is touching' is false then
        //do whatever you want. code here will only execute once--
          the one frame for which both 'is touching temp' is true and 'is touching' is false//
    end if

3
iPhone / iPad / Android / Re: Easy Location Share with Google maps
« on: July 16, 2018, 10:48:14 pm »
That looks like it works really well. Cool! The UI also looks better just by removing unnecessary buttons.

4
If you're making a desktop or web/HTML5 game then you probably don't need scaling modes at all and can disable all but the 1x mode. You shouldn't use the larger scales if you don't need them anyway, since the larger images can take up a lot of storage. I think the Stencyl devs changed the default scale to 1x (don't quote me on that), but even if not you can change it in the settings. This will prevent 4x from being the default option when you import graphics.

If you imported your background at 4x then you'll need to re-import it at 1x.

Do you have a playable demo showing what the background scrolling is doing?

"Elemental Dungeon" and "Elemental Castle Adventure" are two Ludum Dare games of mine that use the Image API for lighting. Since they're compo entries, the source is available for download. See: http://ludumdare.com/compo/author/merrak/

The links to the Stencyl projects should still be live, although you might need to track down a couple of extensions from the forum to properly import them. It's been a while since I've looked at those projects, but I usually put lighting routines in a scene behavior (game manager, HUD manager, light manager... usually something like that).

5
Ask a Question / Re: Actor steps on button
« on: July 16, 2018, 05:13:36 pm »
Using math like JeffreyDriver suggested is usually easier than physics (and faster for most cases), although depending on the size and shape of your hit boxes, a simple distance calculation may not be sufficient.

If you want to use collisions, a good approach to detecting when two shapes are touching is to use a double boolean.

Code: [Select]
When updating
    Set 'is touching' to 'is touching temp'
    Set 'is touching temp' to false

When colliding
    Set 'is touching temp' to true

The double boolean is used for the 'on ground' behavior in the Jump and Run Kit, since you can't assume updating or collision events in multiple behaviors will execute in a particular order. The double boolean also gives you a means to trigger a custom event when the button is pressed, and not allow a second execution unless the button is released and pressed again.

Code: [Select]
When updating
    Set 'is touching' to 'is touching temp'
    Set 'is touching temp' to false

When colliding
    Set 'is touching temp' to true
    if 'is touching' is false then
        //do whatever you want. code here will only execute once--
          the one frame for which both 'is touching temp' is true and 'is touching' is false//
    end if

Furthermore, other behaviors can read the value of 'is touching' to know if a player (or anything else) is actually touching the button. Monitor the value of this attribute to get the state of the button.

6
Ask a Question / Re: Can you join two numbers with one another?
« on: July 16, 2018, 04:58:23 pm »
((# as text) & (# as text)) as number

7
Ask a Question / Re: Actor steps on button
« on: July 16, 2018, 12:39:00 pm »
Can you post a screenshot of your current code?

8
First of all, I'm not really an expert in mobile, but I do work a lot with raw images and Image API... so maybe I can help.

I think the scaling modes will be easier to understand if you know what problem they're trying to solve. Imagine developing a game on something like the iPhone X with a very high number of pixels per inch, versus an older device like a Samsung Galaxy S2. The iPhone X resolution is 2436 x 1125 where as the S2 resolution is 800 x 480. Yes, the iPhone X has a bigger physical screen, but not by much (about an inch and a half), where as the pixel width and height dimensions are almost triple.

So if you build a game at resolution 800 x 480, it will fill the entire screen of the S2, but only an area of about 1/9 that of the iPhone screen.

Without scaling, you would have to build an 800 x 480 version of your game for the S2, and a separate 2436 x 1125 version for the iPhone X.

To get around this dilemna, we have scaling modes. By using the 3x scaling mode, you can build a single 800 x 480 version of your game, and a 2400 x 1440 version will be automatically generated. In addition, any code relevant to screen position is adjusted as well. Say you have some code that places an actor at 400,240--that is, the center of the screen. The 3x scaling mode will know to adjust that to 1200,720 for the iPhone X so that the actor is still placed at the center. Essentially, you can design your game as if the iPhone X had the same resolution as the S2.

Now there's a potential issue: Scaling graphics up in size tends to distort them. The solution is to import your graphics at a higher scale: 3x or 4x, then have Stencyl downscale them. Downscaling is generally less distorting then upscaling. So the best practice is to draw your assets very large, give Stencyl the 4x version, and let it create the smaller 1x version. You can do this the other way around: give Stencyl the 1x version and let it generate the larger 4x version. However, it's easier to delete information than create it, so you'll usually get a better image by drawing a large image and importing at 4x.

Raw images and Image API gets a bit tricky with scaling modes. If you have code already, it'll probably be easier to post it and fix it than start from scratch... although I do have a few examples of dynamic lighting (LD games--so not mobile) if you want to look at them.

9
Also, thanks for the warning about hard-coding the tile size. It would be very tedious to have to make all of those changes.

I learned it the hard way :D

10
Your current code will return true if the upper left corner of the actor lies in the tile. To enforce your stricter requirement, you should also check if the lower right corner is also in the same tile.

Code: [Select]
if tile exists at row floor(y of self / 32), column floor(x of self / 32)
AND
row floor(y of self / 32) = row floor((y of self + height of self) / 32)
AND
column floor(x of self / 32) = column floor((x of self + width of self) / 32)

This will return false if any corner of the actor lies in a different tile, which may not be what you want if you have, say, a 2x2 grid of tiles and want the actor to turn to the 2nd animation if it's inside the grid. In that case, replace my code with a check that all four corners lie inside a tile.

Note: I'd suggest avoiding hard-coding the tile size (32) and use the width/height of a tile blocks instead. If you ever have to change the tile size for any reason, it'll be a real pain to go through all your code and change the 32s.

11
By "inside" do you mean completely inside, so that the "outside" animation is used if even one pixel of the actor is outside of the tile boundary?

12
Ask a Question / Re: Building games under Archlinux issue
« on: July 15, 2018, 04:31:35 pm »
I think I ran into this issue back when I used Arch (moved to Ubuntu now). I don't remember how I fixed it--probably had to find the library in its package and install it. See if this helps: https://bbs.archlinux.org/viewtopic.php?id=67869

Quote
The pkgfile tool is your friend. wink It is in the community/pkgtools package.
Did you install these packages?
bp:~$ pkgfile libpcre.so
core/pcre
bp:~$ pkgfile libssl.so
community/apache13
community/lib32-openssl
core/openssl
bp:~$ pkgfile libmysqlclient.so
extra/libmysqlclient


13
Windows / Mac / Flash / HTML5 / Re: Space Pirate
« on: July 14, 2018, 09:35:09 pm »
This is as far as it gets on Wine (attached). I'm surprised it didn't work, since I've had success with other Stencyl games and Wine. What Stencyl build are you using? Is it one of the later beta ones?

14
Ask a Question / Re: Need to learn how to debug....
« on: July 14, 2018, 01:12:18 pm »
Interesting. When I get a chance I'll look at it...on my phone now. I didn't notice it earlier but the width and height of the "invisible wall" do appear to be the same size as your actors.

15
Windows / Mac / Flash / HTML5 / Re: Space Pirate
« on: July 13, 2018, 06:54:35 pm »
Looks like fun :) Wish I could try it out.

Actually, maybe it will run it under Wine. I have a gaming computer with a Steam controller, but I'll need to install Wine on it to give it a try.

Pages: 1 2 3 ... 133