[Solved] Working with Asteroids sample game, can't get extra guns to work

Here’s a mystery. I’m trying to get guns working from all three gun points on the ship I’m using for my asteroids revision. I’ve created two additional gun points, lwgun and rwgun, each on their appropriate “wing” on the ship. I’ve only added the code for the left wing gun so far, but, as I fought with last night, it will not fire from all three (at one point last night, I had it firing from the two wing guns, but not the main gun point, then only from the left wing gun). Now it only wants to fire from the main gun at the front of the ship (its nose).

Changing the order of the Create bullet statements has no impact on which gun fires, btw. I’m attaching two images—one showing the gun points defined (the ones on the “wings” are lwgun and rwgun, and the red one on the nose is firepoint).

Creating new bullet images (e.g., player_bullet2 and player_bullet3) and using those, and of course, adding the code below for both, also has no impact.

Well, I can only add one image, so you’ll have to use your imagination for the second one. I tried to do it right…system wouldn’t let me.

At this point, I’m stuck. Help please… :frowning:
Thanks,
–Jim

I added 2 more gun points in the example on the sides and this is the events I’m using, it works for me:

There is a perfect example of it right here.
https://editor.gdevelop-app.com/?project=example://shooting-bullets-explanation

It shows how using a for each statement can do exactly what you are asking for.
just open the multiple objects scene and look at the events. pretty easy.

So, I just name all three gun positions firespot, each with its own point? Sorry, I just split mine into three different actions, still only got the “main” gun firing, and the engine, which doesn’t even have a point defined (nor did firespot), but was working, suddenly moved to the front. I’m about as confused right now as is possible for a human. At this point, I’m thinking about scrapping what I’ve done (about a week’s worth of progress) and starting over from the original sample code.

Oh, and the gun that is working only fires in one direction, regardless of the angle of the ship. Fun stuff now. And yes, it’set right (or at least, what was right)—I copied/pasted what was there before.

You can name them whatever you want but yes this is how I did it.
I have 3 custom image points firespot, firespot2, firespot3. Again, you can name them whatever you want.
And then as you can see on the screenshot, I simply create the bullet 3 times for each point individually.

This is probably because you did not set the angle of the bullet to be the same as the ship.
If you do it as I explained and as I shown on the screenshot it should work.

It is for creating the bullet at position of different objects, but the OP want to create 3 different bullet in 3 different position of the same object, so in this case for each can’t be used unless the OP attach 3 different turret object to the ship.

I’m going to see if the forum site will let me attach a second image—the image of the ship I’m replacing the triangle thing with, and its firepoints. Fingers crossed. :slight_smile:GunPoints

Ok, so that worked! The red point in front doesn’t seem to have a named point,
but unless it and the other grey point under it are both in front, firing from the front doesn’t work. And even then, it doesn’t work correctly (fires in only one direction, despite having “Do = player.Angle() to angle of player_bullet” set for each one (yes, I did have that set)). Oh, and “engine” doesn’t have a named point, but still works, shooting flame (in space…) out from the back.

The “code” for each bullet looks like this (barring any typos or
mistakes caused by the fact that something lately has been bogging
the CPU on my Linux system down, and it can’t keep up with my
typing (skips letters, spaces, and even words).

Create object player_bulet at position
player.PointX("“firepoint1"”); player.PointY("“firepoint1"”)
Do = 1 to Z-order of player_bullet
Add to player_bullet a permanent force, angle: player_bullet.Angle()
degrees and length: Variable (player_bullet_speed) pixels
Do = player.Angle() to angle of player_bullet

The only difference for each is firepoint1, firepoint2, and
firepoint3. And I used the existing bits from the code for the
one bullet (which is nice and easy to read and understand).

So, before I do a quick “mv NuevoRoids NuevoRoids.fubar ; mkdir NuevoRoids” and start from scratch, does anyone see anything wrong with the above? Or have any other idea what might be going on (e.g., code that I missed, buried somewhere in the game code, that impacts firing bullets)?

Thanks

The red point is called “Origin”

You mention 3 points only but you have 4. Each point must have a name.
Also in the expression you did put some of the points in to double quotes ““firepoint””. It should be only single quote “firepoint”. Make sure the name is correct and that you create a bullet in position of each point.

In your screenshot you created the bullets first and than set the angle, it is not going to work like that.
You need to create the bullet and set the angle for each bullet for each point.
If you do it as I shown on the screenshot for each point individually it should work.

In the example the point is called “engine”.
If you don’t set a name, or misspell a name the result is going to be 0 which may work if you are lucky but not because you don’t need a name, just pure luck 0 works.

So, make sure:

  1. every single point has a name, they must have a name
  2. you did spell the name of each point correctly
  3. you put the names in to single quotes “pointname” in the event
  4. you set the angle for each and every bullet

Do it as I shown you on the screenshot.
Good luck :+1:

The first time I extracted the original code, all of the points were there, and were named. Then I started from not-quite-scratch (I know better than to not document my modifications so I can go back and redo them if/when needed), the engine and firespot points were not there, but they worked as if they were. These were both extracted from the same original Asteroids.zip. Now that I think about it, though, it’s when I created those missing points that things started acting … weird. Makes me wonder if they were there, and maybe just didn’t get shown in Edit Points for some strange reason.

Anyways, I’ve created a new directory (moving the old one as mentioned before) and am going to try again from a fresh copy, based on the theory that maybe the one I’ve been working with was corrupted somehow from the moment I extracted it from Asteroids.zip. But first, it’s time to feed my big monster Jinx and my tiny girl, Tiggerbelle, then get my own breakfast. :slight_smile: I’ll let everyone know how things work with the re-start. And if it’s missing any points that should be there for the triangle ship, I’ll extract it again…and again, and again, until it’s right. That way, I’ll know I’m starting with a clean copy.

Final update: I started with a fresh copy, as planned, followed the layout from above, and it works fine. I think the previous copy might have been bad. Btw, “engine” still doesn’t have a defined point that shows up in the list of points. But, by running it once, I determined that the red point at 0,0 was the engine, moved it to the correct spot, and now it’s good. Now I just need to change the line art asteroids to the real asteroid images, add a cool background, change sound files, and start working on levels. Each level will get progressively more difficult, and go well beyond the default by the time they’re at the top levels. 3 guns won’t be excessive at those levels, nor will the Mass Blaster I’m adding (ship rotates 4 times firing the entire time). I’m also adding back the hyperspace move that I remember from when I was a kid, blowing away quarters like a maniac on games like asteroids. I recall that it could save your backside or end it, depending on the random spot where you reappeared.

One more thing I’m going to add, after the player finishes the more difficult levels (and I will have an option to turn this off, in case they find it annoying), will be about a 6–8 frame sprite converted from a video of my still very young (he’ll be 17 months old on the 6th—Maine coons don’t even start their REAL growth until about two years old, and keep growing until about five years old … males, that is; females don’t grow nearly as big) Maine coon, Jinx, doing what you see in the still image attached. :slight_smile: Personally, at least for cat lovers, I think this might help the game’s popularity by tugging at some heart strings, as they say. But again, there’s the option that will be there to turn it off, in case I’m wrong about that.

1 Like

Btw, if anyone has any comments on my idea about adding Jinx’s gimme five sequence, let me know. I’m curious… Oh, and those tiles are 16" x 16". Yes, even though he’s still a growing boy, he’s already much bigger than your “average” house cat (if there is such a thing as an “average” size).

I’ve been getting different results each time I extract the zip file (no idea why).

The first time I extracted Asteroids.zip, everything was defined in Edit Points. I, however, messed up on levels to the point that I just started from scratch, extracting the zip archive again. Edit the original ship, edit points: no engine point defined, and no firespot defined (and neither was on the graphic), yet both worked as expected. Ok, so I replace the triangular “ship” and create the missing points as well as the two “wing” gun points. That’s when things REALLY started going strange. Eventually, I posted here. Then, I decided to start from another clean copy from the zip archive. All points except engine defined. And when I ran the test, engine fired from the red dot’s location (near 0,0). So I moved it to the back of the ship, and it works like it should now, including firing from all three gun points in the correct direction. Why is it different every time I start from a “clean” copy from the zip archive? I have no idea…just that it is, and that for the first time, this one works.

Oh, and the double quotes was a copy/paste error or something like that (I didn’t put those in there). I corrected that when I checked it with the first version I extracted and saw the difference.

Strange stuff was happening before… Seems all ok now, though. Well, ok, the actual point definition of “engine” still isn’t there, and it’s the red point that’s where the engine is located, but… Yeah. At this point, I’ve got the triangle replaced with a ship (clearly one designed for atmospheric operations, as it has wings), the line art asteroids are now real asteroids, and all three guns are working properly. Now I need to, as time allows working around multiple appointments this week, get levels and level transitions done (already done in the previous, bad copy, so I know exactly how…just need to write it), change out the sound effects, add a volume control, add some game stuff, etc. Basically, all simple stuff left to go before I start getting friends to play/test it (knowing my friends, though, I’d bet that only one will actually do so).

The only thing I can think of is that you copy the “old” project from the zip over your previous project and because the one in the zip is technically “older”, you open the autosave of your previous project which is more recent but missing the points. An other thing could be If you delete the object you also lose the image points but I think it is obvious. The points are not linked to the image but the object. The same thing can happen if you delete the animation. If an image point is not shared between animations and you delete the one with the point, you lose the point too. If none of these then I have no idea why the image points are disappearing for you.

If an image point is missing, you can create the point. Just make sure you spell the name correctly, if the events reference to a point called “engine”, make sure you name the point “engine” and not “Engine” or anything else.

I don’t extract the new copy over the old; I rename the directory for the old one, and create a new NuevoRoids directory for the new version. That way, I can refer back to exact code for things like level changes that I did get working nicely.

And yes, while working on the second one, the one that got me to post here, I did spell the points exactly as they were supposed to be—case and all. After years (more like decades) of being a Unix (BSD 4.2, NOT SYSV … hate SYSV) guy, you get used to things being case-sensitive, even Unix vs UNIX™. Unix is used for all versions that are not the origianal AT&T System V UNIX that was, a long time ago, owned by what was, before divestiture in 1984, AT&T Bell Labs—the all-caps name is trademarked and owned by whoever owns the rights to it this week. Linux, FreeBSD, and other Unix variants (ancient ones I’ve worked with include IBM’s AIX, DEC’s Ultrix, a straight BSD4.x release on a VAX while in college, SunOS, and more) are all Unix, not UNIX. Calling any of those UNIX could lead to a law suit against you. Yeah, case-sensitive is the norm at all times. :slight_smile: (Ok, that’s not technically true; for example, some of the Internet-related RFCs specifically disallow case-sensitivity, e.g., for host/domain names on Internet, so Bart.Com is exactly the same as bart.com or [can’t actually use it—site thinks it’s a link and won’t let me use more than two] the same in all caps.)

Anyways, as I was saying, it’s when I did re-create the missing points, spelled correctly including case, that things really went nuts. That’s why I’m not touching that this time around. “engine” is defined in there, somewhere, somehow…I might not be able to see it, but it’s got to be hidden in there to work correctly, right?

Yes I believe the “engine” image point must be defined in the sample out of the box. Maybe the point is hard to see at the left side of the image, but under the image, you should see the point “engine” listed and it X and Y position that you can change.

In case there is truly no image point called “engine”, I really don’t know why. I do have it when I open the sample. I don’t know how to help you. But the truth is, you can’t be afraid of breaking things otherwise you can’t get further. Always make backups of your project and don’t be afraid of trying things and break it. As a Unix/Linux/BSD guy you should be comfortable with breaking things :sweat_smile:

Anyway, I’m sorry I could not help. Good Luck :+1:

As a Unix/Linux/BSD guy, I’m comfortable with the stability of the systems. :slight_smile: A long time ago, as a DoD contractor, I had a system with an uptime of 325 days. We had a government project that we had to add two huge disk drives (internal) for, and had to shut it down. I really wanted to see that 365 days uptime. Oh, well. :slight_smile: I have, however, also seen how Murphy’s Law works with backups. I once had a capacity planning system for the backbone network for a fortune 15 company I worked for as an intern and after I got my B.S. I’d developed this when I was an intern, and continued working on it as a full-time emplyee. Anyways, during a two-week Christmas break, my system was crashed by power problems across the floor. This was back when filesystems weren’t as stable and forgiving as they are now, and the filesystem was trashed. But that’s ok, I had a backup on the NeXT system across from my desk, and its R/W optical drive. Well, it was a beta system, and both backups on it were also corrupted. But that’s ok, because I had a backup on the Sun 4 over in Network Engineering, which was backed up nightly to a tape drive. Well, it had also been taken out by the same power problems, and its tape drive was down. But that’s ok, because I also had a backup on another Sun 4 in Houston, that was also backed up nightly. Except (you know what’s coming, right?) they’d also had some power issues, and that system was trashed…hard. “Oh, and I don’t know who told you that we back that system up, but we’ve never backed it up.” I had backups on my own disks, but had needed those over Christmas at home (confident that I had all those others). So at this point, I’m looking at a career-ending disaster (as a full-time hire, I was the design engineer for this company’s backbone network—THE network that all of their critical and non-critical data networks rode over, as well as voice traffic getting a “free ride” when space was available; one second of unscheduled downtime on that network was instant unemployment). Then I remember doing a demo for Network Control downstairs. It was several months old, and I had a LOT to do to get caught back up, but…

And from some of the accounts I’ve read in groups like comp.unix.admin, that real-world example was completely tame by comparison. Murphy’s Law for backups states very clearly that no matter how many backups you have, all of them will fail when you need them the most.

And with that, this is getting WAY off-topic, so let’s end this thread after any replies to this.

I’d forgotten all about this thread, but here, finally, is the (kind of stupid) answer. Z-levels. As in, the bullets were below the background. Fixed that, no more problem. Now I just need to mark this topic solved.

1 Like