JirkaDellOro / Prima

Repository for the module "Prototyping interactive media-applications and games" at Furtwangen University
https://jirkadelloro.github.io/Prima
10 stars 17 forks source link

Shooting on mouse click #34

Closed Rowan5654 closed 4 years ago

Rowan5654 commented 4 years ago

So I am trying to make a bullet (Node) spawn in when I left click on my mouse.

image

I think I've got the right class, that being the EventPointer, I have no idea what I'm supposed to give it for it's second argument.

It says it needs another EventPointer but whatever I give it gives me an error. If I try pass it the "mouse" variable it tells me I can't use it because it's already been declared. What am I doing wrong?

JirkaDellOro commented 4 years ago

You didn't grok the concept, I'm afraid.

Rowan5654 commented 4 years ago

I'm still a bit confused by where I'm supposed to put the event listener. Should it go in the main.js? Or can it go in the constructor of the Node?

image

I have it here working and giving no errors in my player node but when I click I receive no response from the event listener. no bullet appears.

JirkaDellOro commented 4 years ago

Post links to the application and the code, please

Rowan5654 commented 4 years ago

https://github.com/Rowan5654/Prototyping-interactive-Media-Applications-and-Games-

This is a link to just a folder containing my code.

JirkaDellOro commented 4 years ago

Post links to the application and the code, please

Rowan5654 commented 4 years ago

Ok so I went into the source .ts file of your test application link and studied how events were created and called upon. Then related that information into my own program and with a bit of persistence, got it working. :)

JirkaDellOro commented 4 years ago

And all I needed to do was post the request for the application twice. Do you know how you would do that?

Rowan5654 commented 4 years ago

No I wasn't sure what you meant by "application". All I had was my html file which runs my code.

JirkaDellOro commented 4 years ago

I mean a link I click on and immediately see your application running in my browser. Look up Github-Pages if you don't know how to do that.