Impact

» Edit Game Info

6 years ago by Montana

Hi All

Guess im going to start being a bit of an annoyance as i learn how to use the engine/learn jscript more ...(if its any consolation ive designed/produced games for almost two decades so there's lots i can i give back to the community!)

My question: How would i set movement patterns for platfroms .. so i can create elevators or spinning platforms?

thx

6 years ago by fugufish

for simple linear movements you can check out Biolab Disaster's source ( i think it's there )

basically it works by having 3 entities: a start pt, end pt and the platform

with an update() call , absolute distance measuring, and some neat timers, you can set the velocity of the platform.

or you could use some handleMovementTrace() too

6 years ago by fugufish

feel free to contact me if it's too vague :D

6 years ago by Montana

Well i got the basic platform moving via the void,js and mover.js, but its not very smooth which is why i guess your suggesting the handle movement trace?

Despite this code:
init: function( x, y, settings ) {
this.addAnim( 'idle', 1, [0] );
this.parent( x, y, settings );

The player actually ends up in the 'fall' state ... a ideas why the above code doesnt set the player state to 'idle'?

And whats the benefit of looking at handleMovementTrace over the void.mover mechanism, will it resolve the pixel judder when the player is on the platform?

5 years ago by ebeer

Hi all,

I've recently added the BasePlatform plugin just to suit this purpose. It's quite easy to make it work by just extending it with your own entity. Check it out here:

http://www.pointofimpactjs.com/plugins/view/36/base-platform-entity

I'm working now on a much more versatile version with possible targets and multiroutes so you can toggle between them.

3 years ago by BlondGorilla

Hi Guys

Im building a game similar to frogger, looking for some advice on the best approach to deal with the water scenario. I think its a moving platform issue which is why Ive posted here, appologies if not.

The way Ive been dealing with water in general (ie the player dies if they jump into the water)... is to use one of the blank tiles on the collision layer (46) and in update check if they are on it then kill them...

If you remember the game screenshot here: http://mytheongame.com/wp-content/uploads/2013/03/pFroggerPad.png

there are turtles and aligators floating in the water moving from side to side on the screen alligators kill the player (easy enough) and turtles carry the player to the edge of the screen.

Would a way to deal with this be to have an invisible entity that spawns turtle entities on the side of the screen, if the player moves onto a tile with a turtle, ignore the kill action then somehow link the player to the movement of the turtle entity.... (how would you do that)? any ideas would be awesome guys..

Cheers

10 months ago by jddb

This is my update function for moving platforms. Max and min positions are set in Weltmeister.

    if (this.moveTimer.delta() >= this.moveSpeed / 100) {
				if (this.moveType === 'vertical') {
					if (this.pos.y < this.maxY && this.moving === "down") {
						this.vel.y = this.moveSpeed
					} else if (this.pos.y > this.maxY && this.moving === "down") {
						this.moving = "up";
					} else if (this.pos.y > this.minY && this.moving === "up") {
						this.vel.y = -this.moveSpeed;
					} else if (this.pos.y < this.minY && this.moving === "up") {
						this.moving = "down";
					}
				} else if (this.moveType === 'horizontal') {
					if (this.pos.x < this.maxX && this.moving === 'down') {
						this.vel.x = this.moveSpeed;
					} else if (this.pos.x > this.maxX && this.moving === 'down') {
						this.moving = 'up';
					} else if (this.pos.x > this.minX && this.moving === 'up') {
						this.vel.x = -this.moveSpeed;
					} else if (this.pos.x < this.minX && this.moving === 'up') {
						this.moving = 'down';
					}
				}
			    this.moveTimer.reset();	
			}
Page 1 of 1
« first « previous next › last »

Post Reply

Please login or register to reply.