Forum Topic: Geometry wars style background

(207 views • 14 replies)

This topic is 1 page long.

<< < > >>
None

bcapecci

Reply To Post Reply & Quote

Posted at: 11/8/09 08:56 AM

bcapecci NEUTRAL LEVEL 06

Sign-Up: 03/07/08

Posts: 296

I want to want a reactive background similar to that of geometry wars. Does anybody know an easy way to go about this.


Sad

Archon68

Reply To Post Reply & Quote

Posted at: 11/8/09 10:31 AM

Archon68 LIGHT LEVEL 22

Sign-Up: 09/09/07

Posts: 3,311

Could you post a link/picture?

I code in AS2, in case I forgot to mention it.

BBS Signature

None

bcapecci

Reply To Post Reply & Quote

Posted at: 11/8/09 11:40 AM

bcapecci NEUTRAL LEVEL 06

Sign-Up: 03/07/08

Posts: 296

Sure.

Video: href= here
Picture: here


None

Rustygames

Reply To Post Reply & Quote

Posted at: 11/8/09 11:42 AM

Rustygames LIGHT LEVEL 18

Sign-Up: 05/07/05

Posts: 6,662

Yea just have a bunch of points joined together with lines and each point moves towards the player if he's near by but each point is restricted.

Good luck

- Matt, Rustyarcade.com


None

Johnny

Reply To Post Reply & Quote

Posted at: 11/8/09 12:24 PM

Johnny DARK LEVEL 21

Sign-Up: 04/17/04

Posts: 4,404

I think you could achieve something like that using bitmapData and either a convolution or displacement filter.

All sites currently down. Deal with it. <3

BBS Signature

None

Rustygames

Reply To Post Reply & Quote

Posted at: 11/8/09 12:29 PM

Rustygames LIGHT LEVEL 18

Sign-Up: 05/07/05

Posts: 6,662

At 11/8/09 12:24 PM, Johnny wrote: I think you could achieve something like that using bitmapData and either a convolution or displacement filter.

Ah yea that's true, that's better then my idea

- Matt, Rustyarcade.com


None

bcapecci

Reply To Post Reply & Quote

Posted at: 11/8/09 01:10 PM

bcapecci NEUTRAL LEVEL 06

Sign-Up: 03/07/08

Posts: 296

Displacement filter is a great idea. Thanks


Questioning

Mahora

Reply To Post Reply & Quote

Posted at: 11/8/09 01:29 PM

Mahora LIGHT LEVEL 02

Sign-Up: 01/02/09

Posts: 88

ohhh...pretty..
You could also make a grid of points and use them to draw the lines (with lineto and stuff) and move the points around.


None

CkGordon

Reply To Post Reply & Quote

Posted at: 11/8/09 02:45 PM

CkGordon LIGHT LEVEL 09

Sign-Up: 04/13/05

Posts: 477

Hi, not sure if this is much help from a noob but maybe you could try and fake it by just adding the background "sucking in" animation to the explosion movie clip on a lower layer and masking off everything outside of your boundries? Sometimes the quickest and simplest can achieve the same effect as the complicated. ;)

The preceding statement was bullshit.
Playstation Network: CkGordon
Battlefield: Bad Company 2 March 2nd, 2010

BBS Signature

None

Johnny

Reply To Post Reply & Quote

Posted at: 11/8/09 02:49 PM

Johnny DARK LEVEL 21

Sign-Up: 04/17/04

Posts: 4,404

At 11/8/09 02:45 PM, CkGordon wrote: Hi, not sure if this is much help from a noob but maybe you could try and fake it by just adding the background "sucking in" animation to the explosion movie clip on a lower layer and masking off everything outside of your boundries? Sometimes the quickest and simplest can achieve the same effect as the complicated. ;)

The lines would only line up a small percentage of the time, and it would be horribly obvious that it had been cheated.

All sites currently down. Deal with it. <3

BBS Signature

None

Rustygames

Reply To Post Reply & Quote

Posted at: 11/8/09 02:52 PM

Rustygames LIGHT LEVEL 18

Sign-Up: 05/07/05

Posts: 6,662

At 11/8/09 02:49 PM, Johnny wrote:
At 11/8/09 02:45 PM, CkGordon wrote: Hi, not sure if this is much help from a noob but maybe you could try and fake it by just adding the background "sucking in" animation to the explosion movie clip on a lower layer and masking off everything outside of your boundries? Sometimes the quickest and simplest can achieve the same effect as the complicated. ;)
The lines would only line up a small percentage of the time, and it would be horribly obvious that it had been cheated.

Yea it will look awful and won't be very easy, displacement filter will look cool I think and will take all of about 30 minutes

- Matt, Rustyarcade.com


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 11/8/09 02:59 PM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,377

How is the filter a better idea? Just render the lines in medium quality.

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Pyromaniac

Reply To Post Reply & Quote

Posted at: 11/8/09 03:00 PM

Pyromaniac EVIL LEVEL 18

Sign-Up: 01/14/05

Posts: 2,976

You can edit this to fit your needs possibly. Its something similar to what you need.

w = 13;
h = 10;
gw = 550 / (w - 1);
d = .7;
k = .15;
sd = 50;
showgrid = true;
dd = 0;
createEmptyMovieClip("pointHold",2);
for (i = 1; i <= h; i++) {
	for (j = 1; j <= w; j++) {
		mc = pointHold.createEmptyMovieClip("p_" + i + "_" + j, ++dd);
		mc._x = mc.ox = Stage.width / 2 - (w - 1) * gw / 2 + gw * (j - 1);
		mc._y = mc.oy = Stage.height / 2 - (h - 1) * gw / 2 + gw * (i - 1);
		mc.onEnterFrame = main;
	}
}

pointHold.onEnterFrame = function() {
	clear();
	lineStyle(.25,0xffffff,40);
	for (i = 1; i <= h; i++) {
		mc = _root.pointHold["p_" + i + "_" + "1"];
		moveTo(mc._x,mc._y);
		for (j = 2; j <= w; j++) {
			mc = _root.pointHold["p_" + i + "_" + j];
			lineStyle(.25,0xffffff,40);
			lineTo(mc._x,mc._y);
		}
	}
	for (i = 1; i <= w; i++) {
		mc = _root.pointHold["p_" + "1" + "_" + i];
		moveTo(mc._x,mc._y);
		for (j = 2; j <= h; j++) {
			mc = _root.pointHold["p_" + j + "_" + i];
			lineStyle(.25,0xffffff,40);
			lineTo(mc._x,mc._y);
		}
	}
};
function main() {
	if (this.vx == undefined) {
		this.vx = 0;
		this.vy = 0;
	}
	this.vx += (this.ox - this._x) * k;
	this.vy += (this.oy - this._y) * k;
	var dx = this._x - _root._xmouse;
	var dy = this._y - _root._ymouse;
	var dist = Math.sqrt(dx * dx + dy * dy);
	if (dist <= sd) {
		var a = Math.atan2(dy, dx);
		this.vx += (_root._xmouse + sd * Math.cos(a) - this._x) * k;
		this.vy += (_root._ymouse + sd * Math.sin(a) - this._y) * k;
	}
	this._x += (this.vx *= d);
	this._y += (this.vy *= d);
}

None

bcapecci

Reply To Post Reply & Quote

Posted at: 11/8/09 09:24 PM

bcapecci NEUTRAL LEVEL 06

Sign-Up: 03/07/08

Posts: 296

At 11/8/09 02:59 PM, GustTheASGuy wrote: How is the filter a better idea? Just render the lines in medium quality.

I don't know if it's so much a better idea as a more straightforward one. The previous code I was pretty lost in whereas a filter is easy. I just have to basically put it on every reactive object. If I used points I could get a better looking effect but its more difficult, I have to apply the forces of each object to the points and then restrict them.


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 11/9/09 04:33 AM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,377

Dude it's a simple spring. You accelerate the particle in the direction it's displaced and damp it and that's it.

for (p in grid)
{
  spring (p);
  forces (p);
}

connectPoints ();

function spring (p)
{
  p.vel += strength * (p.anchor - p.pos); // these are vectors
}

function forces (p)
{
  p.vel += pixToVec (influencemap.getPixel (p.pos.x, p.pos.y));
  // use a bitmap to accumulate the displacements
  // each frame caused by player and bullets
}

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


All times are Eastern Standard Time (GMT -5) | Current Time: 12:00 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!