Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / making a randomized 2D shooter. Some Questions.

Author
Message
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 20th Aug 2020 08:55
Hi squad,

I've been playing a lot of Blazing Beaks, and now that Covid19 has made me unemployed I have all day to work on projects. So I decided to try and make a similar game.

So I bought a copy of AppGameKit studio and here we are.

I just wanted to make a thread to get help with different issues as they come up, ill post all the code for advice and other beginners can see the evolution. I've had some great help in the past from forum members with pong and a space invaders game, such a wonderful commuity of experts on here.

And so my wonderful experts, I have some questions.

1) is there a better way to generate the level?

I have made a function which stores the floor tile data in the array floordata. I then randomize a start hatch position and an end hatch position, and then wrote a piece of code which changes the roof tiles to floor tiles. It keeps worming around until it touches the exit hatch.

I was wondering if there is a better way to do it, sometimes it takes a second and sometimes it takes over 10 seconds until it hits the hatch. It would be nice if it didn't keep going over the same tiles?

2) My second question is to do with the wall collision.

I wrote some code which I have commented out because it wasn't quite working how I wanted. The basic idea is it checks whether the player sprite (number 1) collides with any of the tiles, then checks if the tile is a floor, if its floor nothing happens. If its wall or roof the player is moved to the previous x and y position. After tinkering with it I could kind of get it to work, but the player would freeze if he touched 2 walls, also he couldn't "slide" across a wall whilst touching it. I guess you would have to do 2 checks? one check for the x and one check for the y? Im a bit of a noob with the standard mechanics for collision in 2d games

3)Also lastly, if anything is Glaringly wrong in terms of good coding practice, please let me know how to improve I might ask some dumb questions when you give me the advice but I would love to learn as much as possible.

Looking forward to the tips!
Code and media attached.


Attachments

Login to view attachments
Richard Stevens
User Offline
Joined: 14th Jan 2020
Location:
Posted: 21st Aug 2020 23:09
I tried to have a play with this, but the downloaded attachment sizes don't seem to match the code.
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 22nd Aug 2020 10:31
Really?
Ill try embedding
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 13th Sep 2020 08:51
Hey guys.

After a short break I've done a little update. I've redone the level randomization code so it doesn't get errors anymore.

I've added a gun and you can now shoot the zombies.

I haven't implemented a sliding collision yet.

I hope you enjoy watching it progress Please send your coding tips if you can think of better ways to do anything

blink0k
Moderator
7
Years of Service
Recently Online
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 13th Sep 2020 08:59
It might be more helpful if you create a .zip of your project and attach that
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 13th Sep 2020 12:30
Hows this?

Attachments

Login to view attachments
Virtual Nomad
Moderator
14
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Sep 2020 21:49 Edited at: 14th Sep 2020 21:56
Quote: "Please send your coding tips if you can think of better ways to do anything "

i did

meanwhile, consider implementing depth sorting based on a sprite's current Y to eliminate this:

we have a theoretical 10,001 different depths we can set a sprite to; you shouldn't need more than 480 based on your virtual resolution (and can probably get away with ~1/10 of that, or less, depending on sprite shapes).

otherwise, your project is moving forward; it's good to see
[My Itch.io Home] [#LowRezJamAGK2020]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]

Attachments

Login to view attachments
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 16th Sep 2020 11:06 Edited at: 16th Sep 2020 11:07
YES! I just did that!, it was suprisingly easy Uploaded the latest update

I finally also managed to implement a sliding collision! I used defined areas instead of checking for collision

Ive also added rockets. Press control to swap to a rocket and shoot a zombie.

Next ill add an attack for the zombie.

I have another dev question, at what stage do you start tackling the main menu? Do you usually finish most off the game and then make the menu?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2020-09-18 22:23:52
Your offset time is: 2020-09-18 22:23:52