More help with my gravity bear game.
http://arcade.gamesalad.com/g/85328 gravity bear prototype,
FIRST QUESTION
few days ago i made this post asking for help getting my character to turn when touching walls. i got some great advice from several folks, and it worked great.
http://forums.gamesalad.com/discussion/43907/caught-in-a-loop-help#latest
but now i have a problem, i want pushable blocks, and i want my character to be able to push the block, but then the block hits a wall or something and can no longer be pushed, the character should turn around,
but using the current system, the character only turns when he bumps objects tagged "bounce collision" and the move block can not be tagged such, or the character will turn as soon as he touches it.
i have tried making a rulle that when the push block touches a wall that its tag changes to "bounce collision" but that seems to do nothing.
so i am trying to rework completely how my turning works. like making it anytime the characters foreward progress stops, it turns. that way any object no mater the tag that it runs into would force the character to turn. but i'm not sure how to go about this.
i have not tested the following yet, cause i am at work when typing this.
but is there a way to make an atribute that keeps track of the current lin vel of a char? i know there is the normal lin vel under self motion, but i believe it stays a flat number that controls the speed setting, and does not change with actual movement of the character. on screen, for example a lin velocity of 30 would not auto switch to 0 when bumping a wall correct?
if i could track the actual current lin velocity i could make a rulle that says anytime current lin velocity =0 then set self motion lin velocity to -self motion lin velocity, that would in theory make the char turn around anytime it ran into something that stopped his progress correct?
SECOND QUESTION
in the prototype i posted up top i have implimented a power up bar that fills up one tick every 2 secs (turns out thats slow, but will be tweaked) whenyou are on the ground, but when you press up to stick to the ceiling the bar goes down, when it gets to 0 your gravjuice runs out and you fall, also added a power up that when you pick it up, it adds 2 ticks to your meter.
currently i am making the meter grow by increasing/decreasing its width by *5 everytime a tick is added/removed from my grav bar atribute interger. this works great, but the bar grows in both directions, and i would like it to only grow one direction, to the right. any thoughts on this?
thanks guys! this has been a lot of fun, few more things to add then i'll start working on a prototype actual level!
FIRST QUESTION
few days ago i made this post asking for help getting my character to turn when touching walls. i got some great advice from several folks, and it worked great.
http://forums.gamesalad.com/discussion/43907/caught-in-a-loop-help#latest
but now i have a problem, i want pushable blocks, and i want my character to be able to push the block, but then the block hits a wall or something and can no longer be pushed, the character should turn around,
but using the current system, the character only turns when he bumps objects tagged "bounce collision" and the move block can not be tagged such, or the character will turn as soon as he touches it.
i have tried making a rulle that when the push block touches a wall that its tag changes to "bounce collision" but that seems to do nothing.
so i am trying to rework completely how my turning works. like making it anytime the characters foreward progress stops, it turns. that way any object no mater the tag that it runs into would force the character to turn. but i'm not sure how to go about this.
i have not tested the following yet, cause i am at work when typing this.
but is there a way to make an atribute that keeps track of the current lin vel of a char? i know there is the normal lin vel under self motion, but i believe it stays a flat number that controls the speed setting, and does not change with actual movement of the character. on screen, for example a lin velocity of 30 would not auto switch to 0 when bumping a wall correct?
if i could track the actual current lin velocity i could make a rulle that says anytime current lin velocity =0 then set self motion lin velocity to -self motion lin velocity, that would in theory make the char turn around anytime it ran into something that stopped his progress correct?
SECOND QUESTION
in the prototype i posted up top i have implimented a power up bar that fills up one tick every 2 secs (turns out thats slow, but will be tweaked) whenyou are on the ground, but when you press up to stick to the ceiling the bar goes down, when it gets to 0 your gravjuice runs out and you fall, also added a power up that when you pick it up, it adds 2 ticks to your meter.
currently i am making the meter grow by increasing/decreasing its width by *5 everytime a tick is added/removed from my grav bar atribute interger. this works great, but the bar grows in both directions, and i would like it to only grow one direction, to the right. any thoughts on this?
thanks guys! this has been a lot of fun, few more things to add then i'll start working on a prototype actual level!
Best Answer
-
MotherHoose Posts: 2,456
when: block can't move (collides with wall)
what happens: bear changes direction (MLV)
you could use a gameAttribute to show that block has collided and stopped
or … since depth of your game needs many gameAttributes
and, since our littleBear needs lots of conditional rules
and, not too many blockActors in game:
unlock the blockActor in sceneInstance
-set the rules for behaviors when collided with Bear
(probably constrainAttribute: self.Position.X to Bears with offsets)
-set a rule for when overlaps or collides with wall
---changeAttribute: scene.layer.bear.Motion.LinearVelocity.X
==for other thoughts/questions
if you use the Graphics: Flip Horizontally to control MLV
you can also use it for the collide with walls rules/behaviors
1st Rule on bear: when
Attribute: self.Graphics.Flip Horizontally is false (when facing Right)
--changeAttribute: self.Motion.Linear Velocity.X to 100
Otherwise: changeAttribute: self.Motion.Linear Velocity.X to -100
then Rule: when
Event: overlaps or collides with wall
--Rule: when
--Attribute: self.Graphics.Flip Horizontally is false
---changeAttribute: self.Graphics.Flip Horizontally is true
--Otherwise: changeAttribute: self.Graphics.Flip Horizontally is false
another Demo with block pushing: http://www.mediafire.com/?2dg4iae24om42dfMH
Answers