Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Trouble making jumping spider enemies

$
0
0
I'm trying to make a jumping spider enemy for a side-scrolling 2D game. I want the enemy to jump, wait, then jump again. the scripting that I have put together causes the spiders to float away instead. void Update(){ if(!seesPlayer && !patrolling) { patrolTimer -= Time.deltaTime; } if (patrolTimer <= 0f && !patrolling) { patrolling = true; Patrol (); } } void Patrol() { moveDistance = Random.Range (-moveSpeed, moveSpeed); myRigidbody2D.velocity = new Vector2(moveDistance, jumpHeight); patrolTimer = Random.Range (.1f, 2f); patrolling = false; }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>