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
1
Years of Service
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
8
Years of Service
User Offline
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
15
Years of Service
User Offline
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
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 17th Oct 2020 07:56
Another update for anyone following.

-Added dogs that spit bees

-Added attack for the zombie,

-Started a mainmenu (but not used, at start mainmenu is set to off)

-swapped the controls to phone controls

-upsized the sprites to 48 instead of 32 because it was too small for phones

- rejigged the collision code to suit new map size

- redid all the projectiles into one UDT

- put all enemies into one UDT

- added a destructables UDT (you can now smash boxes)

(Thanks for the help in my various threads, more updates soon, on track to finish this game by christmas. Hoping for 5 worlds of 5 levels).

Attachments

Login to view attachments
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 17th Oct 2020 09:28 Edited at: 17th Oct 2020 09:29
i dig the bees (which, of course, any dog wandering in a lab will spit) and all of your graphics, in general.

Quote: "swapped the controls to phone controls"
consider leaving desktop controls in, as well? so, something like:


then, in your Input() function:

my tired eyes would appreciate it.

and, since you're going Mobile with this, make sure to consistently use lowercase filenames so you don't run into any issues. it looks like you have except "Scientist48.png".

thanks for the update
[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]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 17th Oct 2020 10:40
Dude your the best! THanks! I will rename my files.

Also, I will do that regarding keeping both controls.

Next update
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 21st Oct 2020 11:56 Edited at: 22nd Oct 2020 07:57
UPDATES ATTACHED

I have drawn and programmed the first boss! Its a bee that spawns dogs that shoot bees haha. the level is set to 5 for testing (bosses always appear on level 5)

It also has a fast attack that lunges at the player, programming this proved tricky but I got there in the end with a bit of rightangle triangle maths (thanks school)

There's also now phone and keyboard controls. and all files are lowercase.

Enjoy the new code and boss.
I feel the speed in which the new creature was created, implemented and made functional is a nice testament to the value of rewriting your code as you learn better habits. Its very simple for me to add new enemies now because of the advice recieved from board members in my various threads.

I think I will start working on the heads up display next. Including hearts, damage and weapon type etc.

after that ill get back onto the mainmenu.

once that is done Ill start working on the pickups.

Then when that is done.. its just more enemies and bosses until the game is done.

Still hoping to be done by Christmas, enjoy the update.

Attachments

Login to view attachments
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 21st Oct 2020 12:49
attached to what?
[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]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 22nd Oct 2020 07:57
hmm this seems to be a thing. Every time I attach something i have to go back and edit the post and re-attach.

Im using edge on windows.
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Oct 2020 18:31
the forum attachment issue (for some browsers) has been around for awhile; it will get resolved some day

meanwhile, the latest update is a definite push forward for Elixirâ„¢. it's feeling more like a full-fledged game, now.

can't wait for Damage and basic Sound to take it to the next level
[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]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 10th Nov 2020 07:17
Hey dudes!

Damage is working.

Some basic sounds are up.

Enjoy the next update!

Also started on the next world, started a little bit of the pickups as well.

Attachments

Login to view attachments
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 14th Nov 2020 11:52
Another update if anyone is following.

I am getting an error to do with the file size of this little gorilla boss.



I think I can fix the problem by just mirroring the sprite instead of having left and right drawn in the file. But Im also wondering if there is documentation as to the limits on file sizes somewhere? Or is there another way to load larger images for sprites?

Thanks in advance.
PSY
Valued Member
4
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 14th Nov 2020 19:01
I'm not getting an error on Windows 10 / Studio, but the help states the following:

Image width and height must be between 1 and 2048 pixels, some devices may support larger sizes but this is not guaranteed

Just use several rows for the animation in your gorilla sprite file, and you're good.


PSY LABS Games
Coders don't die, they just gosub without return
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 14th Nov 2020 21:45
Yeah I dont get a problem with windows 10 either.

Rows! I see!

So obvious. Thankyou
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 26th Nov 2020 06:15
finally had a play with the latest version and found a rude surprise! that's a good thing

appreciating the sound effects, music, progress and hard work.

please keep moving this forward
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 14th Dec 2020 11:21 Edited at: 14th Dec 2020 11:26
Im glad your enjoying it Virtual Nomad!

Hello everyone (or maybe just you VN)

I have made lots of changes

- added the boss to world 2
- added another enemy type to world 2
- added sparkles to drops
- added max distances to projectiles ot change play
- new menus, press escape to bring up the start of the inventory menu
- fixed lots of little bugs
- changed how enemies shove each other
- press alt to cycle through your different ammo types, this also has a display now in the HUD
- changed the HUD

I am still hoping to launch this game before XMAS day. What do people usually distribute free games on? I would love for it to be available to download on PC, MAC, ANDROID and IPHONE.

Much love and Enjoy Elixir.
PS it's actually getting kind of hard. Like you have to really concentrate to not get hit.

Attachments

Login to view attachments
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Dec 2020 20:13 Edited at: 14th Dec 2020 20:16
i don't have a lot of subscribers on my youtube channel but it, and the view count here, do depict that others are enjoying elixir's progress. don't let the lack of comments deceive you; we are not alone i tend to lurk on a lot of projects that i'm interested in but only comment on a few; i'm sure others do the same.

Quote: "What do people usually distribute free games on?"

there may be other, perhaps more popular sites but itch.io would be a great place for elixir.

you didn't mention intent to export to HTML but i suggest that you consider it where all platforms would be able to play it online, downloads could also be made available from the same page. see my P3 jam game for example where, basically, 3 versions are available. if you do go that route, make sure to add Made With AppGameKit to the metadata as a sort of cross-promotion. and, if you're not up for an HTML version, itch would see make a good home for your game(s).

Quote: "it's actually getting kind of hard."

nothing wrong with that but i will need to focus more if i plan on facing boss #2 based on my last few plays

nice update; thanks for that.
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 15th Dec 2020 02:33
NICE GAME! I really enjoyed that. Such a simple concept but got sucked in immediately.

I will check out itch.io I've never downloaded a game from there but I see lots of games that im playing are on their front page So it sounds like the right place.

To be honset I'm not expecting anyone to actually play my game. I'm a professional acrobat and producer and my game is actually based on my circus show Elixir, which is starting touring next year (now that we have Covid under control in Australia I can work again).

I think Im just gonna give the first 10 people to beat the game free tickets to the show. If 10 people actually play it all the way to the end then Ill be stoked haha (and very suprised)

I think im the first person to run away from the circus to be a software developer lol.

If anyone here is from Perth or Adelaide in Australia, and wants free tickets to a great circus fringe show. Wait here and clock my game and get free tickets to this --> https://fringeworld.com.au/whats_on/elixir-fw2021

Thats also why im trying to get it done by Xmas, my show opens on the 15th of Jan so I wanna give people two weeks to finish it
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Dec 2020 19:55
Quote: "my game is actually based on my circus show Elixir"

very cool. so, we can expect a physics-based sequel?
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 15th Dec 2020 23:04
haha maybe! Ill get my head around physics sprites sometime, it seems like they are actually much simpler than the methods im using.

Im thinking of making an infinity runner next based on my other circus show Railed. Which is cowboy themed. Thinking of having a cowboy run along the top of a train and you have to dodge and jump and shoot things. High score based.

I might try to make it semi-3D with quads. Or theblender course I started months ago and use a model. So many options with AppGameKit
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 6th Jan 2021 11:58 Edited at: 6th Jan 2021 12:30
Hey dudes im ready to release an Alpha version to itch.

How do I compile? When I compile mine its not Elixir but another project?

EDIT I have attached the zipfile.

When I take the executable away from the project folder and compile, I get a wierd program telling me the height of a tree or something from a certain distance (some pythagorus teacher?)

Attachments

Login to view attachments
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Jan 2021 07:28 Edited at: 9th Jan 2021 08:32
Quote: "When I compile mine its not Elixir but another project?"

no idea what you have going on. do you mean the .exe included in the latest attachment is running a pythago-something on your end? because it seemed like "real" elixir to me (i just watched the menu effect). and, i recompiled with the same result.

perhaps you're launching some other exe inadvertently?

otherwise, to be clear, you've been compiling fine throughout the history of this thread. are you doing something different for some reason?

meanwhile, are you ok leaving all your media exposed to anyone who might d/l it on itch?

add: gave it a quick run and all seemed well. will take some getting used to re: changing weaps, using items which i dont have right now but looking forward to playing more.

and, i decided to test an html export and found an issue that you need to be aware of: while Windows is forgiving when it comes to case and file names, html and mobile aren't. ie, it will error on html looking for roar.wav while the filename is actually Roar.wav. renaming to roar.wav and it loads/runs fine on edge.

also, if you do include (or go elusively html (which i recommend)), consider how the ESC key is used by browsers to exit fullscreen. it's not much of an issue with this (while it breaks some of my own projects) but its something to think about.

finally, check your PM
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 9th Jan 2021 13:50
Hi nomad!

Yeah when I drag the EXE file out of the folder and onto my desktop, I run it and its a pythagorus trainer. Super wierd.

Does the EXE file need the media library and the main.agc? Or does it zip everything up into itself? I think maybe I had a pythagrous main.agc somewhere on my desktop.

Is there a way to not have all my media exposed on itch?

Also I have tried on html5 and it ran super slow. Just checked your html 5 version, it seemed to run a little better, did you increase frame rate? or do anything else special.

Thanks again for the consistent help, Its actually a little daunting to try and put something on the internet

blink0k
Moderator
8
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2021 18:43
Quote: "Does the EXE file need the media library and the main.agc?"

Yes. Specifically the media/byecode.byc file
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Jan 2021 19:02 Edited at: 9th Jan 2021 19:39
the .exe. is just the generic AppGameKit player for windows. it will look for the bytecode.byc file (which is what our code is compiled to) in the media folder and play it. without bytecode, you should just see the generic player offering "unconnected". do you have some stray bytecode in a media folder on your desktop?

otherwise, yes, the media folder needs to be there with all of your media and the .byc. see THIS recent thread re: "protecting" your media or making it less visible which references a few methods including password-protected zip files (which AppGameKit can handle natively) and nz0's WadPacker (which i have no experience with but many use it). meanwhile, the HTML export does tuck the media inside a bit, making it less visible but still accessible while our android exports, for example, basically zip the project up into an APK file (without a password).

Quote: "on html5 and it ran super slow"

yeah. i added print(ScreenFPS()) before the sync() (and nothing else) which reports ~22FPS on HTML for me (i've updated the html. try it yourself if you want to see your FPS).

after reviewing your code a bit, i don't think you're using timer-based movement which means its going to run as fast as it can (up to the sync rate you specify), period. IE, it won't account for less than 30 FPS and "skip" ahead to maintain a constant move rate.

while you don't have much going on in-game, my guess is that the code is fairly inefficient, causing the slowdown which most of us fall victim to early on, or decide not to care about either go through your ~6,600 lines of code and make it more efficient, or call it "success", as is, as a solid learning experience that delivered what you hoped for.

finally, you've brought this a long way and should be proud to show it off to the world (which you've been doing since you started this thread, btw).

sidenote, THIS (non-AGK HTML game) has been my go-to time-killer of late (. i've been playing it on my laptop from home for weeks. a few days ago i had to travel and, using the hotel's wi-fi, the game played at least twice as fast and i can't imagine why or what's under the hood that could cause it to do so on the SAME laptop. point: there's a lot that i don't understand, so take any advice i've offered with that in mind
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 10th Jan 2021 16:05
Hey Nomad!

A rewrite is defintely not on the cards ahha. Not in the next coming months anyway, im back on tour now in Australia so no more programming for me for a bit.

This was a wonderful learning experience though, and a great introduction to making games. I do consider it a great success, im glad you enjoyed my journyey.

One last thing,

I have done some updates, and am trying to export it for use in the play store. App game kit freezes up when trying to make an APK file..

Could you please make one for me? Or run me through how to do it? Sorry if this is a bummer but I cant seem to get it to word. It freezes whenever I try.

Ive attached the updated versionI made lots of edits I think this can count as the final game.

* Bee attack nerfed from 5 to 3 damage
* writing stays up for 33% longer for slow readers
* ammo pickups tell you to press alt to swap weapons
* Instruction splash page improved, now only has the instructions for PC or phone dependent on what your on
* Textbox displays on menu to say how to navigate
* vending machines will no longer be distance based, firekey is disabled and enters the vendingmenu
* Vending machines will display a potion or coin next to price
* Minor text changes
*rocket pickups are now 4 ammo not 10
* Prices displayed while not vending
* Hearts will only be picked up if not able to be used
* hearts will only be vended if able to be picked up
* Invisibility , Reload speed, damage etc Will all be explained on splash pages

Attachments

Login to view attachments
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Jan 2021 23:29 Edited at: 10th Jan 2021 23:35
see attached. tested and runs on my old samsung j320.

no personal experience with the play store but there are a few threads around that should help if you need it.

meanwhile, please do add this to itch.io. if for no other reason, so i can listen to the catchy tune once you create the page, you can add me as an admin (look top right under "more"). i believe my username there is virtual-nomad. once that happens, i'll add an HTML version.

otherwise, thanks for the update. i still can't beat BOB but i'll keep at it.

and, i want to say "good luck" with the tour but i believe it's proper to say "break a leg" (or hip/whatever's appropriate), instead.

finally, consider a post in the showcase board where it would get proper attention vs "making a randomized 2D shooter".
[My Itch.io Home] [Now Playing]
[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: 11th Jan 2021 12:33
Your a gem nomad!

Ive put your APK up on itch! It WORKS!

Ive made you an admin also, sent you a request and a PM here.

So far tour is going great! Not a single broken anything!

Once again, your a gem!
Thomas John Gorham
2
Years of Service
User Offline
Joined: 23rd Jun 2018
Location:
Posted: 12th Jan 2021 02:09
Hi Nomad,

Altkey doesnt work on HTML 5 on either mine or your version. Any ideas what this could be?
Virtual Nomad
Moderator
15
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Jan 2021 04:53
ah, no idea. i just tried changing to:

but still didn't work, so:

and, CTRL worked in HTML version (uploaded).

i dont know that i've used ALT key in HTML so never knew there was an issue :/
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]

Login to post a reply

Server time is: 2021-04-17 01:32:42
Your offset time is: 2021-04-17 01:32:42