Mintoris Forum

Author Topic: Space Invaders II  (Read 18714 times)

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #40 on: Apr 19, 2016, 01:42 AM »
Hey Chuck, did you get a chance to look at the latest version I uploaded? If so, what did you think? Take your time. I hope the manual is coming along.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #41 on: Apr 19, 2016, 02:15 AM »
The program looks really good. I kind of think you can go further with it. I've combined you tiles into one bitmap that you can load into the program as it stands now. It will give you sprites 1-32. the new set starts at tile 17.

The manual is going slow and there are so many more pages to write (and diagrams to draw).

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #42 on: Apr 19, 2016, 01:36 PM »
I'm trying. Am I to understand that the setonwhateversub command will include that sub throughout the execution of the program. It's there a certain time interval, every so many milliseconds, that subs are called, or does a condition have to exist for a sub to be called? I just need help understanding this architecture. It's all new to me. The manual looks great by the way. Great explanations and examples. Keep up the great work. If you want to release a halfway there version of the manual, every little bit will help. Thanks for your dedication to this project, and thanks for encouraging me not to give up.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #43 on: Apr 19, 2016, 04:48 PM »
When you set an interrupt, like a collision sub, it remains set until you change it. The event sub then gets called once every time the particular event occurs. I'll try to spend an hour on the program today after I get off work.

To get a transparent background, I edit your tileset image with gimp, use the magic wand to select all the black background. Then I press delete.


-Chuck
« Last Edit: Apr 19, 2016, 08:41 PM by Chuck »

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #44 on: Apr 19, 2016, 11:11 PM »
Ok, this is a good place for me to stop. I left some bugs in there for you to fix.

Oh, I found a bug while working on this today, so you will need the update I'm about to send out.




Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #45 on: Apr 20, 2016, 12:43 AM »
I meant to put the following distance code in the onTouch()

Code: [Select]
  If action = Touch_Down Then
    If dist(GenGetSpriteCenterX(ship), GenGetSpriteCenterY(ship), x, y) < 64 then
      playerFire()
    Endif
  Endif

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #46 on: Apr 20, 2016, 12:04 PM »
Hey Chuck, Here is the code so far. Firing done by touching either side. However, I'm trying to limit the bullets to 5 but I can't create a dimensioned variable missile (5), I declared global missile (), then dim missile (5), like you did with your enemy variable, but I can't create the sprites. Keeps saying it was expecting an object. What am I doing wrong. I fixed the movement of the enemy. It will no longer be a problem. Using set velocity instead of move to and it works much better. Had to add a main() sub to make it work.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #47 on: Apr 20, 2016, 11:24 PM »
I spent a few hours on this today. You will need today's beta release.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #48 on: Apr 21, 2016, 03:13 AM »
You can probably change the wait in the main loop to 100ms. Nothing is moving that fast.

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #49 on: Apr 22, 2016, 03:03 AM »
Hey Chuck, since my last update, the touch no longer functions properly.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #50 on: Apr 22, 2016, 04:53 AM »
I sent out the fix for the touch problem.

I got the firing controls working really well in the attached version. Not sure what I changed to fix it, I was distracted with the touch problem.

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #51 on: Apr 24, 2016, 01:16 PM »
Ok Chuck, I changed the firing to shoot only when touching either side, so you can stop firing when you want. Sometimes you want to save your bullets until you are in a certain position. I added multiple levels, added speed and animation increases as the enemies decrease. I would like red bars from 0 to 120 and width-120 down the whole side of each side of the screen like fire bars barely opaque mostly transparent. Next is the boss who crosses the top randomly throughout each level. We need enemy bullets and the barriers. In tiny font, score top right, lives to left. We are almost there. Let me know what you think. Only bug I can detect so far is sometimes the enemy changes colors when they should be white. Then the best part, particle effects. I can't wait to try sprites as particles.

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #52 on: Apr 25, 2016, 03:28 AM »
I have added enemy bullets, but have not added the collision part yet. Just to tired. I take it when a sprite leaves the screen, it is killed automatically or is that a setting option.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #53 on: Apr 25, 2016, 03:35 AM »
GenSetGlobalBounds width, height, Edge_Kill_Sprite


This command sets the screen boundary and tells the Game Engine to kill the sprites that cross the boundary.


rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #54 on: Apr 26, 2016, 12:54 AM »
Hey Chuck, I have added the barriers. For some reason, only some of the barrier fragments are detected in the collision. Are there too many sprites for the collision detection, or am I doing something wrong? See the attached version.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #55 on: Apr 26, 2016, 03:00 AM »
The problem is that the collision detection routine only allows 10 sprites per 100x100 square on the screen. This didn't seem to be a problem when sprites are usually 32x32 or greater. Right now I don't know how I'm going to fix this. Everything I try slows the game engine down to the point that it is non-functional.

I think this might just be a limitation of the game engine.
« Last Edit: Apr 26, 2016, 04:25 AM by Chuck »

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #56 on: Apr 27, 2016, 03:05 AM »
Hey Chuck, I have taken care of the barrier collision problem. On to other things. I used old fashion if then's. It works well in conjunction with the game engine as sprites aren't moved by me anymore so the program can take care of a lot of stuff and still the sprites always move at the same speed. Cool‼

rasdini

  • Sr. Member
  • ****
  • Posts: 111
Re: Space Invaders II
« Reply #57 on: Apr 27, 2016, 05:55 AM »
Chuck, is there any chance you could add a freeze sprites command. All sprites freeze until the unfreeze command. Commands could be genfreezesprites and genunfreezesprites. They continue on their previous movement once unfreeze is used. This would be a nice feature to have for times like the pause before spawning a new life, so the aliens don't keep advancing while you are dead and waiting to respawn.
I was also curious if you've considered adding sprite way points or could it be done.  That way, you could have the sprites follow any pattern you wanted. Circling the outer perimeter of the screen or zigzagging or just going back and forth.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #58 on: Apr 27, 2016, 06:09 AM »
Use the GenPause On | Off command to pause the game engine.

Yes, paths sound good for future upgrades.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: Space Invaders II
« Reply #59 on: Apr 27, 2016, 09:24 PM »
I added some text for you to play with.

Changing the font size in the GenDefaultFont command changes the size of the font bitmap. This changes it's placement in the atlas. In this case the font is 32x32, but you could make it smaller without changing the atlas since a smaller size bitmap will still fit into the same atlas position without overlapping other tilesets.

Code: [Select]
Sub initScore()

  const scoreText = GenText("0", font, 100, 100, 256, Align_Center)

  ' It's always best to size the font correctly
  ' in the GenDefaultFont instead of using the scale
  ' (When possible)
  GenSetTextScale scoreText, .80
  GenAddText scoreText, score_layer

End Sub