r/futile • • May 21 '13

Some help

0 Upvotes

Hey im using this Code but it always and it always is false

    float xx = ((Input.mousePosition.x + offsetX) * touchScale);
    float yy = ((Input.mousePosition.y + offsetY) * touchScale);

    for (int f = 0; f < filas; f++)
    {
        //cada fila
        for (int c = 0; c < columnas; c++)
        {

            if (this.world.Rectangulo[c, f].Contains(new Vector2(xx, yy)))
            {
                Debug.Log("Inside");
            }
        }

the world.rectangulo is an bidimensional array, that Im using simulation a grid, of 32x32 each cell, cause Im using drag and drop, and I just want that if I drop an item in one cordinate the cordinate could have an status,

this is the method that create the grid

that its inside the World class

private void CreateGrid() { int columnas=23; int filas = 15;

        int xmin = -400; //my resolution is 800 weigth it means -400 one side and 400 other side
        int xmax;

        int ymin = 240;// my resolution heigh is 480 it means 240 one side, -240 other side
        int ymax; 


        for (int i = 0; i < filas; i++)
        {
            //each row
            for (int j = 0; j < columnas; j++)
            {
                xmax=xmin+32;
                ymax = ymin-32;

                //each column
                //i is the column
                //j is  the row
                //rectanculo = Rect in spanish
               
                 //here im giving the values of each verice of the sqare or rect

                Rectangulo[j,i].xMin = xmin;
                Rectangulo[ j,i].xMax = xmax;
                Rectangulo[j,i].yMin = ymin;
                Rectangulo[ j,i].yMax = ymax;

                xmin = xmax;

            }
            ymin = ymin - 32; // -32 means that it start from -400 x cordinate, and 280 y cordinate,  
            // -32 means that every columns the file will be -32 pixeles and it will start a new row                      //down
             xmin = -400;
            xmax = 0;
        }

    }

I dont know why it always is false, cause, I loop all the screen resolution on the rectangulo array and then search with the if statement inside a HandleSingleTouchEnded(FTouch touch) and its always false, Help me


r/futile • • Oct 04 '13

Background as a image from device camera (WebCamTexture & futile)

0 Upvotes

Hi! I've got a problem with WebCamTexture. Without futile it works ok, I just set GUITexture.texture = WebCamTexture and everything is ok. After Futile.instence.Init - black screen. Help?

// sample code

public class IceCreamTruckGame : MonoBehaviour {

public GUITexture myCameraTexture;
private WebCamTexture webCameraTexture;

void Start () {

	for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++)
    {
        if (!WebCamTexture.devices[cameraIndex].isFrontFacing)
		{
            webCameraTexture = new WebCamTexture(cameraIndex, Screen.width, Screen.height);
		}

    }	
	
	myCameraTexture.texture = webCameraTexture;

	webCameraTexture.Play();	
}

}


r/futile • • Oct 19 '13

[shaders] Awesome game (not futile) with awesome shaders

1 Upvotes

Look at this beauty, I don't know anything about shaders but I guess they play an important role in the feeling of the game :

http://www.freeindiegam.es/2013/08/probe-team-andrew-shouldice/

This is a motivation to learn shaders.


r/futile • • Aug 14 '14

Generation of banana sprite in banana game

1 Upvotes

Hello all ..

I want to create random object at random position so i was reading the banana game.

I dont understand how this banana sprite is generating ?

Can anyone explain me?

Thanks.


r/futile • • Dec 04 '14

How to create screen Menus in futile

1 Upvotes

Hi guys.I started using futile a week ago for a 2D game i'm working on.I must admit there isn't much documentation but this forum is a gold mine!I have been trying, unsuccessfully, to create the menus for my game.I'm sure it's pretty easy, but since futile is new to me,it's taken me days.So far the transitions between the screens i.e Loading page,then the main menu, then the select towns page is all working by clicking a next/play button.My challenge at this point is :

I want to have another stage on top of the default one in the select towns page, which displays different towns with next/back arrows that a user can select.Like in this link
https://play.google.com/store/apps/details?id=com.fingersoft.hillclimb

So far, this is what is have and nothing is shown on the screen:

public void Start(){

		Futile.instance.camera.cullingMask = 1 << LayerMask.NameToLayer( "Default" );
		//Futile.instance.camera.depth = 1;
		Futile.stage.layer = 0;
		//we create a new camera that only renders objects  in the scrolling stage

		GameObject scrollingCameraHolder = new GameObject();
		scrollingCameraHolder.transform.parent = Futile.instance.camera.transform;
		scrollingCameraHolder.name = "Scrolling Camera";

		Camera scrollCamera = scrollingCameraHolder.AddComponent<Camera>();
		scrollCamera.CopyFrom( Futile.instance.camera );
		scrollCamera.orthographicSize = 90;
		scrollCamera.clearFlags = CameraClearFlags.Depth; 
		scrollCamera.depth = 5; // above main camera
		//scrollCamera.rect = new Rect (limit, 0, 10 - limit * 2, 1);
		scrollCamera.enabled = true; // Disable the camera component so you can render it manually
		scrollCamera.backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); // Your "ambient light" colour
		//scrollCamera.cullingMask = 1 << LayerMask.NameToLayer( "Scroller cam" );
		scrollCamera.cullingMask = 1 << 5;
	//create a new FStage that holds the camera

		FStage scrollStage = new FStage( "Scroll" );
		scrollStage.layer = 5; 
		//scrollStage.layer = LayerMask.NameToLayer( "Scroller cam" ); // Make sure to set up your layer in the Unity editor
		Futile.AddStage( scrollStage );


	}

How can i accomplish this?


r/futile • • Oct 10 '12

How to create a touch area without using FSprite

1 Upvotes

How could I create a touch area without using FSprite? This is probably a stupid question, but Ive just gotten back to working with Futile and Im a bit rusty.. ;)

I know I could create an image which is the size I need and then just set the alpha to 0, but I would imagine theres a better way..

Id like to create a touch area of a certain size and be able to get the position inside of the touch area.


r/futile • • Jun 27 '13

Flip Y axis so +Y is going down

1 Upvotes

I'm converting a game to Futile that was built with XNA. In XNA the Y axis is styled like Windows where Y=0 is the top and +Y is heading down. I noticed Futile flips that. Is there a way with options to flip it back? Or a simple way to modify the source to flip the positions?


r/futile • • Oct 04 '14

Atlas scale x3?

2 Upvotes

Hi all. Should I be using a 3x scale?
I've always stuck to 1,2,4, but I have just created a matrix and now I'm not sure...
Here's my thinking: http://i.imgur.com/01Woqni.png


r/futile • • Jan 07 '14

Performance issues on OUYA when having sprites extend past viewport.

2 Upvotes

I have some sprites that extend past the viewport that seem to be causing some performance issues. No performance issues when running in the editor or stand alone versions.

First of all I was only getting about 40fps on the OUYA. I checked my android player settings and "unchecked" 32-bit Display Buffer and 24-bit Depth buffer. This pushed me up to 50fps. Next I had an idea about something i was doing that might causing issues.

I have "light rays" coming down as you can see in the gif below. Those extend quite a bit pas the view port.

gif

I turned these off and sure enough. 60fps! Now I'm not sure of the best way to keep these in without causing the performance issue, but shortening the rays to only extend just barely past the viewport I can get about 54fps, 57fps. This is okay, but I feel like I need to address this. Is this type of thing something I should just steer clear of or is there a camera setting or something that may help with this?

Thanks!


r/futile • • Apr 12 '13

Futile + C# + mobile, but without Unity?

2 Upvotes

I like a lot of things about the Futile framework & the tech stack it's built on. Unity, however, is mostly redundant: I don't use the scene editor or anything much else, for that matter.

Is there an alternative tech stack that features futile on C# on opengl es for x-platform mobile game development?


r/futile • • Sep 22 '14

Packrat : setting texture max size ?

3 Upvotes

I love packrat, but is there a way to specify the maximum size of the generated texture(s) ? I want to avoid having textures larger than 2048x2048 for my game to work on low-end devices. Or maybe there is a way to achieve this by quickly hack its code ?


r/futile • • Nov 08 '13

Futile and Parallaxing

3 Upvotes

I'm using ManaOrb's extra classes for a project of mine. I want the camera to follow the player and have parallaxing backgrounds (i.e., foreground scrolls more quickly than the background). However, nothing I try seems to be working.

Is there an example of how to use the FParallaxContainer class anywhere? Ideally one that also shows how to set the camera's world bounds appropriately?


r/futile • • Apr 03 '13

FSprite flipping

4 Upvotes

Simple addition of flipX and flipY properties like in cocos2d.

FSprite.cs Properties section:

protected bool _flipX = false;
protected bool _flipY = false;

In UpdateLocalVertices() before _isMeshDirty = true add:

	if (_flipX)
	{
		Vector2 temp = _localVertices[0];
		_localVertices[0] = _localVertices[1];
		_localVertices[1] = temp;
		temp = _localVertices[2];
		_localVertices[2] = _localVertices[3];
		_localVertices[3] = temp;
	}

	if (_flipY)
	{
		Vector2 temp = _localVertices[0];
		_localVertices[0] = _localVertices[3];
		_localVertices[3] = temp;
		temp = _localVertices[1];
		_localVertices[1] = _localVertices[2];
		_localVertices[2] = temp;
	}

Getters/Setters section:

virtual public bool flipX 
{
	get { return _flipX;}
	set 
	{ 
		if(_flipX != value)
		{
			_flipX = value; 
			_areLocalVerticesDirty = true; 
		}
	}
}

virtual public bool flipY 
{
	get { return _flipY;}
	set 
	{ 
		if(_flipY != value)
		{
			_flipY = value; 
			_areLocalVerticesDirty = true; 
		}
	}
}

r/futile • • Aug 26 '13

Ludum Dare 27 Complete! Made a game with Futile

5 Upvotes

I just completed my first game jam, having participated in the LD27 48hour competition. It was a blast! Thanks Matt, for your great framework. I jumped into Unity/Futile about 3 weeks before the game jam, so I could figure it out and be able to post builds to the web. All I've used before this was Cocos2D for iOS but the transition was a breeze.

My game submission is up on the LD site: http://www.ludumdare.com/compo/ludum-dare-27/?action=preview&uid=25089

Would love to hear who else participated and used Futile. And if you're planning to rate some games, check mine out and let me know what you think!


r/futile • • Aug 20 '12

Futile 0.6 alpha is out!

11 Upvotes

I pushed all the new changes that were in development to the master on GitHub, so now the stuff I've been working on for the past week is there.

You can read the full list of commits here: https://github.com/MattRix/Futile/pull/8

You can get the actual files here: https://github.com/mattrix/Futile (the Unitypackage is up-to-date too)

To summarize the big changes:

  • Multiple stages that are transformed using GameObjects

  • stage.Follow() and stage.CenterOn() which can be used to treat stage movement like a camera

  • Breaking out screen related stuff into Futile.screen (width,height, orientation, etc.)

  • Many performance tweaks, including using more efficient loops

  • FRepeatSprite - for doing tiling backgrounds with scrolling

  • Fixing a bad bug in GoKit

  • Renamed "Helpers" to "Extras"

The only major change to the API is that now width+height will be at Futile.screen.width instead of Futile.width, and so will all the orientation stuff. It made a lot of sense to break all the screen-based functionality into a separate class.


The biggest new feature is the ability to have multiple stages. Futile.stage will still exist, but now if you want you can add stages with Futile.AddStage(someStage).

So why would you want to do that? Well basically because I did a ton of work to make the stages special. From now on any transforms you apply to them (x,y,scale,rotation) will actually get applied to the root GameObject instead of transforming the whole tree below them. Normally in Futile, if you move a parent, then all of its children will have to be transformed as well. But now for the stage, nothing will get transformed except for the GameObject(s) that everything is getting drawn into.

In more practical terms, this means that if you scroll the stage, you're going to see just as good performance as if it wasn't moving at all.

I created the concept of multiple stages so that if you want, you can use Futile.stage for your main game content (perhaps a tilemap that scrolls) and then you can create another FStage for all of your UI, or whatever. It's really up to you. Futile has all the same commands that FContainers do, except with stages, so you can AddStage(), AddStageAtIndex(), RemoveStage(), etc.

I also created a few special methods on the stage called CenterOn(), Follow() and Unfollow(). These allow you to treat the stage like a camera that will follow your objects. You can call CenterOn() to center the stage on a point automatically (use LocalToGlobal() to get the position in the correct coordinates.

Follow() allows you to make the camera follow a specific FNode at all times, and it can even follow that node's scale and rotation. Unfollow() stops the camera from following that node. I recommend creating a "cameraTarget" node that you can ease to whatever position you want to create a following camera.

It's also worth noting that you'll need your origin at 0.5f, 0.5f so the camera focuses on the center of the stage... if you still want coordinates starting somewhere else, just put a container at the root of your scene and place it at whatever position you want your origin to be.


Ok that's enough about the stage. The other thing I added is the FRepeatSprite, which is a sprite that can having a tiling texture on it. The element this uses must be a single image (using atlasManager.LoadImage()), not from an atlas. You also need to make sure its texture's Wrap Mode is set to "Repeat". Once you have it set up, you can get tiling backgrounds and you can even set the scrollX and scrollY to make it scroll as much as you want. Pretty handy for certain types of games!


Alright, so that's about it! Enjoy, and let me know if you find any issues or bugs.


Update: Just fixed a bug where the game wouldn't compile if you weren't in the editor. I also made another small change, which is that boundsRect has been renamed to textureRect to make it a bit more clear.


r/futile • • Jun 07 '25

Trying to add video support to Futile as a mod for a game.

3 Upvotes

I'm a Rain World (version 1.5 specifically) modder and I'm trying to add video support to the game in my mod. I've been trying to add it for over a month already, and I'm confused. Especially considering that Rain World 1.5 runs on Unity 4.6 (or something like that), and doesn't have the usual VideoPlayer stuff, instead using MovieTexture. Did anyone figure out video stuff for such Unity version?


r/futile • • Aug 27 '12

My entry on Ludum Dare.

2 Upvotes

At the end I managed to use Futile to create fully functional game and submit it to Ludum Dare. Thanks Matt for creating this library. Otherwise I would be forced to use flash (bleeee) :)

It's called Gene Game and you can check it here: Gene Game or original version submitted to Ludum Dare Gene Game

You can check sources too, but as I was in hurry the code isn't very nice.


r/futile • • Aug 19 '12

Spriter support?

3 Upvotes

Would you consider adding support for the Spriter tool to Futile?

Latest forthcoming version originating from this Kickstarter: http://www.kickstarter.com/projects/539087245/spriter

Tool home page: http://brashmonkey.com/spriter.htm (with some alpha builds available)


r/futile • • Aug 24 '12

A message to those using Futile for Ludum Dare

6 Upvotes

I'll be on here periodically throughout the weekend to answer any questions you might have. When you're done, please share whatever you made here on /r/Futile!

Have fun and good luck!


r/futile • • Nov 11 '13

Futile and NGUI input / touches

3 Upvotes

I have NGUI setup and rendering just fine with Futile. I have NGUi setup so that the cameras event mask is set to the NGUI layer only. However, touch events are still being recognized by Futile.

It seems that Futile touch system doesn't care if my touch is actually hitting something on another layer above the Futile layer.

How can I fix this?


r/futile • • Aug 21 '12

Hierarchy of sprites?

2 Upvotes

I'm trying to figure out the best way to create a sprite hierarchy. For example, in Cocos2d, any CCSprite can have an arbitrary number of children sprites. What's the best way to implement something like that? Thanks!


r/futile • • Nov 23 '13

Unitypackage import problem

2 Upvotes

I have created a unitypackage as a quickstart for other Futile projects. However, I notice if I click on one of the files within a new project it opens the files in mono under the old solution.

This also has the effect where I don't get autocomplete on custom classes such as Futile.

Is there something I need to clean down or update when importing packages?


r/futile • • Oct 20 '14

smearing" particles

1 Upvotes

is there any way to make particles "smeared" accross the screen? (think lasers) i set up a simple code to emit particles but they look like little dots across the screen (since it makes a particle per frame)

_FPS = MainScript.FPS;

	_FPD = new FParticleDefinition ("glow");
	_FPD.lifetime = 2;
	_FPD.startScale = 0.25F;
	_FPD.endScale = 0;

...

public void Update (Player _player,List<Fragment> N) {

	_FPD.x = this.x;
	_FPD.y = this.y;
	_FPS.AddParticle (_FPD);

}

(last function called in loop)

EDIT: comet trails are a better example.


r/futile • • Nov 24 '13

How to set an FSprite on a tile?

1 Upvotes

I realize this is extremely basic and also involving 3rd party code. But I'm just trying to get a basic understanding of things. I have a tilemap working fine, with the code below. The tile map is about 15 across by 7 vertical, the tiles are 32x32, and I set the screen to 320x480, so it fills it out nicely and is centered.

Tilemap room1 = new FTilemap("dungeon");
room1.LoadCSV("CSVs/dungeon");   
room1.x = -room1.width/2;
room1.y = room1.height/2;
Futile.stage.AddChild(room1);

FSprite startTile = room1.getTile (3, 3);
	
player = new FSprite("hero_trans");
player.x = startTile.x;
player.y = startTile.y;
Futile.stage.AddChild(player);

But the player's tile ends up off the tile map, below and to the right. I'm assuming I'm missing various aspects like using the anchor, or screenToLocal, etc.


r/futile • • Dec 08 '13

Galaxoid released on Google Play!

Thumbnail play.google.com
4 Upvotes