Gravitational pull=null

Its the start of a new week and I have begun my new enemy type Black hole vortex. So the idea is that the black hole will instantiate from side of the screen and use force to pull the player towards it and damage. Had a good start by creating the sprite and animation. That was the easy part! Then is was getting the black hole to move from one edge of screen to the next, but I didn’t want it to just be on a linear movement. This is space, right? Found the right info on what I’m looking for to make it have float motion. Here is what I found.

The use of a Bezier Curve, which uses four control points to determine the curve shape. Here is a visual of how this works.

B(t) = (1-t)³*P_0 + 3*(1-t)²*t*P_1 + 3*(1-t)*t²*P_2 + t³*P_3, t in [0,1]

By moving the positions of the control points I was able to make a wave motion.

Next was to instantiate the the black hole. through trial and error I found that the previous spawn method would not work because the the range of spawn was off of the x axis and my black hole should range on the y axis. I rewrote a new coroutine for this to spawn correctly. New challenge is to create the gravity pull of the player. I have tried different implementations but was unsuccessful as I don’t fully understand the methods being used and need to dissect it for me to figure out the problem.

New goal for tomorrow.!

Good Night!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Introduction to numpy for data science

Started off from scratch to… building a mobile application

Encrypting Your File Made Easy With GPG

Bitrise Build dashboard

Codewars 練習

Display Max Ammo on UI

Pass The Swift Code Review: Dictionary Edition

Choosing Mono-repo Over Multi-repo

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Maryetta Buckner

Maryetta Buckner

More from Medium

The Potential of the Ape Land — Metaverse

CMO’s letter to the community: Being strong is the only choice

Dear diary,… Queer agony: A podcast

ONSTON Becomes the Strategic Partner for Meland.ai