Attempting Crash Course 2

InterNutter

  • Posts: 15
I believe I'm doing it properly henceforth. I just didn't take a screenie of the enumerated direction code with the updated loops. My bad there.

Now the bullets go down screen. HOWEVER, one of the enemy ships still desynchronises from their "goomba behaviour" and starts drifting down screen.

AFAIK this should not be happening.

« Last Edit: February 16, 2024, 03:35:55 pm by InterNutter »

Luyren

  • *
  • Posts: 2799
I don't know what "desynchronize" and "goomba behavior" is. If you provide screenshots or any visual aid and explain what you mean, someone might be able to help.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

InterNutter

  • Posts: 15
"Goomba Behaviour" is the back and forth motion right and left of the screen. They're all synchronized, traveling together, left and right until the bullets fire. Then one alien ship stops moving along with the others [not synchronized, so desynchronized] and as well as traveling right-left instead of left-right, starts drifting down the screen.

Luyren

  • *
  • Posts: 2799
Likely your bullet actor is not set as a sensor in its collision tab. Your alien ship physically collides with your solid bullet and that interferes with its motion.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

InterNutter

  • Posts: 15
My issues are many so I made a video about it. Have a YouTube link for the thing [I have tried and failed to embed videos in assorted forums so now I just give up -_- ]

https://youtu.be/4lLDuRVND94

Luyren

  • *
  • Posts: 2799
Open your bullet actor, click "Collisions", and check the "Is a Sensor?" box on the right side.
The increment/decrement block only applies to local attributes (the blue ones you create inside the behavior), game attributes don't show up in them.
Click "File > Export Game...", and attach the generated .stencyl file here, that way I can take a better look.
From what I saw, you only have one bullet actor, and it only has an event to hit the player at the bottom. Furthermore, the way you are creating the player bullets, they spawn on top of the player and deal damage.
As for your last question, a sudoku game is possible, but I think that's a bit more "asbtract" than a space invaders clone or platformer for instance, with its own set of challenges. That would apply regardless of your game engine of choice as far as I know.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

InterNutter

  • Posts: 15
Checking the box for bullet collisions fixed the desynchronisation problem. It did not solve the spontaneous immolation problem.

Stencyl code attachment included.

Luyren

  • *
  • Posts: 2799
You decided to make "ShipHealth" a game attribute (purple). Under Settings > Attributes, your ShipHealth is set to 0. Unless you give it an initial value greater than 0, your ship gets Fist of the North Star'd and is already dead before you even compile. You are setting a blue attribute "Ship Health" to 5 in a when created event for the Player Ship. Purple and Blue attributes are different.  Furthermore your "Hit" custom event is decrementing a local attribute (blue). You are mixing two different things.

Solution: remove "Ship Attribute" from Settings > Attribute, then in your "Update" event, replace the purple block with the blue one.

Other notes:
-Use only one "Updating" event in your code per behavior, that's my recommendation. You can have stuff for movement, camera limiting and kill on 0 health all in the same event. Use comment blocks to identify each part.
-There is no code in your bullet to deal damage to the player ship. According to your collision groups, the bullet canot even colide the player ship. That means the enemy ship cannot damage the player at all.
Solution:
1) In your bullet code, replace your collision event with the "something else" collision event (the first one) and adjust your code accordingly. That way your custom event "Hit" will be called for whatever it hits.
2) You'll also need to make your bullet collide with the player ship (Settings > Group).
3) You have to create the bullets further apart from the player ship with an offset. An offset is a position adjustment, something like "X position of self + X offset, Y position of self + Y offset". You must adjust the offsets so that your bullet does not colide with the player ship when created, otherwise it will hit itself. Consult the video I posted earlier about positions. In short, positive X is to the right, negative left; positive Y is down, negative is up.

-You could have made the health portion of your code a behavior, and attach that to both your enemy ship and player ship. That would include health management through non-hidden attributes (ship health as a number that is not hidden instead of setting it on When Created), the "Hit" custom event and death on 0 health. Making behaviors for reusable code is my recommendation.

« Last Edit: February 24, 2024, 07:29:48 am by Luyren »
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

InterNutter

  • Posts: 15
I _think_ I did everything you said [but excluding the parts where they conflicted with the original instructions for this exercise] but the bullets still don't hit the player ship.

I've checked the collision groups three times and I'm certain I skipped a step. Game files included.

Luyren

  • *
  • Posts: 2799
Your bullet groups is set to "WillHit", both in its group (Properties tab) and in its Animation tab.
Player ship is set to "Actors".
In your actor groups (Settings > Groups) "WillHit" only hit "Players" and "Enemies". They do not hit "Actors".

Solution: change the actor group for your player ship (Properties tab) to "Players".

Your player ship cannot fire bullets because you have some "Bullet Pop" if statement in the button press event. It seems you just copies the code from the enemy ship, so you might want to revise that.

Finally, as I stated in my previous message, you have to add the offset to the bullet position when creating it for the player actor. As I explained:
Quote
In short, positive X is to the right, negative left; positive Y is down, negative is up.
You are using a positive Y offset in the player code. You are subtracting by a negative number, so that becomes positive. Remove the - simbol you manually added to the number.

« Last Edit: February 29, 2024, 06:03:24 pm by Luyren »
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.

InterNutter

  • Posts: 15
Yes! Finally! It does everything it's expected to do.

Bless you and sincere apologies for the exasperation ^_^