GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

rotating

ohshoeohshoe Posts: 44Member

Hi if anyone can help me i am trying to make a bullet be limited to 10 and go in the direction of a ship/actor when it rotates. For the limiting of the shot/bullet I am using this video: To rotate the ship/actor i am going to have right and left button controls and to shoot button on the other side of the screen that has

shoot Button
{
rule when touch it pressed/and touch is inside
[Do change attribute game.shoot hold :to true [change attribute game.shoot :to true]]
[else change attribute game.shoot hold :to false]
}

{
rule if attribute game.shoot is true/and if attribute game.shoot hold is true
[Do timer after 0.5 seconds run to complete [change attribute game.shoot to false]]
}

bullet/shot
{
group with
[change attribute self.starting x :to self.position.x]
[change attribute self.starting y :to self.position.y]
}

{
rule if attribute self.what shot am i = game.shot count/and if attribute game.shoot is true
[Do change attribute self.position.x :to game.shooter x [change attribute self.position.y :to game.shooter y [change attribute game.shoot :to false]]]
}

{
rule when actor overlaps or collides whit actor wall
[DO change attribute self.motion.linearVelocity.x :to 0 [change attribute self.motion.linearVelocity.y :to 0 [change attribute self.motion.angularVelocity.x :to 0 [change attribute self.position.x :to self.starting x [change attribute self.position.y :to self.starting y ]]]]
}

ship/player
{
group with
(
rule if attribute game.rotate left is true
[Do rotate counter clockwise at speed 90]
)
(
rule if attribute game.rotate right is true
[Do rotate clockwise at speed 90]
)

{
group with
[change attribute game.shooter x :to self.position.x]
[change attribute game.shooter y :to self.position y]
}

{
rule when touch is pressed/and if attribute game.shoot is true
[Do change attribute game.shot count :to (game.shot count+1)%10 [change attribute game.shoot :to true [timer after 0.5 seconds run to complete [change attribute game.shoot :to false]]]
}

Comments

Sign In or Register to comment.