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.

Android / beginner top down scrolled game help

Author
Message
AuShadow
9
Years of Service
User Offline
Joined: 29th Nov 2014
Location:
Posted: 29th Nov 2014 14:08
Hey all I just want to know if this would be possible with agk, I am very very new to programming and sometimes a little slow to start if you know what I mean. Anyway what I want to do is sort of have 3 images as described below.

Image one would be the main background which would be a constant background,

Image 2 would scroll down so would be a lot taller then the screen and have an alpha section in the middle (also when reaching the end another random selected image from a group would be selected to then scroll down so no 2 plays would be the same)

Finally image 3 would be the "character" and I would have it so that if he moved out of the alpha of image 2 it would trigger an end to the game,

Think like flappy bird,

So basically I'm asking if it could be made so that one image could collide with another and how I would achieve this, thanks in advance for any help to a newb
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 1st Dec 2014 21:31
Quote: "So basically I'm asking if it could be made so that one image could collide with another and how I would achieve this"


if GetSpriteCollision(sprite1,sprite2) = 1

is the main command there i think you are asking for?
i dont think there's any way to not check the alpha though so you would need to remove that?
i guess in flappy bird's case you would use separate sprites for the pipes.. or atleast create collision boxes for each im only a newb myself so i could very well be wrong, would like to know if it's possible to ignore the alpha but from checking i dont see any way to get the colour/alpha at a specific point (which you could have used)

life's one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
AuShadow
9
Years of Service
User Offline
Joined: 29th Nov 2014
Location:
Posted: 2nd Dec 2014 09:03
Ahh yes thanks, was kinda hoping I could use something like that but ignoring the alpha but ahh well, and what do u know smallg, always helpful in reloaded and now scripting agk as well, can't wait to see what you can come up with here
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 4th Dec 2014 17:51
hiya
im just making mini games with agk2 but it's fun learning how not to crash a phone, lol

i think collision shapes is the only way to go with this, depending how accurate you want to be it could take a while to set up but it's probably the best solution right now but it's tricky as obviously you can't see those boxes so takes some getting used to / testing (other than cutting the sprite into pieces - easier to see but more coding)

life's one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Bogie5464
9
Years of Service
User Offline
Joined: 10th Mar 2015
Location:
Posted: 24th Mar 2015 15:32
I need help with my game. dont know what to do. [REM
REMSTART
TITLE - CoCo and The Monkey God
Version - 1.0.0 last upload - 1/29/2015
developer- Bogard
COPYRIGHT - Ingenious Student Labs
Date created - 1/29/2015

remend
rem START SYSTEM SETUP SSECTION
REM STOP SYSTEM SETUP SECTION
REM

REM
REM START INTRO SECTION
REM INTRO SECTION HEADER

REM DECLARE VARIABLES
REM SCREEN DISPLAY
cls 0
load bitmap "\\fs1\studentdirs$\2017\17cbogard\My Pictures\FISH FA CE.jpg"
ink rgb (255,255,0),0 : set text font "arial" : set text size 14: set text to bold : set text transparent
center text 320,100, " Goldy Fish"
center text 320, 420, " Developed by Jason Holm and Bogard"
center text 320, 200, " Hit Arrow Keys To Continue"
center text 320,434, " Copyright (c) 2004 Ingenious Student Labs"
wait key

cls 0





cls 0
load bitmap "\\fs1\studentdirs$\2017\17cbogard\My Pictures\Untitled-1.bmp"
ink rgb (255,50,25),0 : set text font " Times New Roman" : set text size 12: set text to bold : set text transparent

center text 320,100, " You are Goldy."
center text 320,200, "Collect Enough Fish Food to Survive."
center text 320,400, "Good Luck Goldy!"
wait key

REM *** INTRO SECTION LOOP

do
REM SCREEN DISPLAY
REM CONTROL INPUT
x=scancode() : if Keystate(x)=1 then gosub OptionsSection
REM REFRESH SCREEN
sync
loop

REM *** END INTRO SECTION
REM *****************************************

REM *****************************************
REM *** START OPTIONS SECTION
REM *** OPTIONS SECTION HEADER

OptionsSection:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
set display mode 800,600,32
cls 0
ink rgb(255,255,255),0 : set text font "times" : set text size 20 : set text to bold : set text transparent
center text 400,560,"Hit Arrow Key" : Rem Let the player know why the game isn't starting up immediately
sync
wait key
REM *** INTRO SECTION LOOP

do
REM SCREEN DISPLAY
REM CONTROL INPUT
x=scancode() : if Keystate(x)=1 then gosub MainSection
REM REFRESH SCREEN
sync
loop

REM *** END INTRO SECTION
REM *****************************************

REM *****************************************
REM *** START MAIN SECTION
REM *** MAIN SECTION HEADER

MainSection:
REM DECLARE VARIABLES
REM SCREEN DISPLAY
cls 0
ink rgb (255,50,25),0 : set text font " Times New Roman" : set text size 12: set text to bold : set text transparent
REM OBJECT CREATION
make object cylinder 1, 100 : Rem Cube
color object 1,rgb(255,155,0)
position object 1, 0,50,0



REM LOAD MODELS
REM SET CAMERA
position camera -20,100,-300 : Rem Set camera position
point camera 0,50,0 : Rem Rotate camera to point at a specific place
REM REFRESH SCREEN
sync

REM *** MAIN SECTION LOOP

do
REM SPECIAL EFFECTS
REM OBJECT ORIENTATIONS
P1X# = object position X(1)
P1Y# = object position Y(1)
P1Z# = object position Z(1)
A1X = object angle X(1)
A1Y = object angle Y(1)
A1Z = object angle Z(1)
REM CAMERA ORIENTATIONS
Rem Store the positions of the Camera as variables
cpX# = camera position X()
cpY# = camera position Y()
cpZ# = camera position Z()
Rem Store the angles of the Camera as variables
caX# = camera angle X()
caY# = camera angle Y()
caZ# = camera angle Z()
REM LIVE SCREEN DISPLAY
ink 0,rgb(255,255,255) : set text font "times" : set text size 16 : set text to bold :
center text 400,520,"Goldy"
center text 400,535,"Get The Food"
center text 400,550,"Help Us"




REM CONTROL INPUT
if Upkey()=1 then move object 1,10
if Downkey()=1 then move object 1,-10
if Leftkey()=1 then Yrotate object 1,wrapvalue(A1Y-5)
if Rightkey()=1 then Yrotate object 1,wrapvalue(A1Y+5)
rem steps
for t=0 to 5
make object box t+7,50,10,50
position object t=7,0,5=(t*20),100+(t*100)
color object t+7,rgb(10,200,100)
make object collision box t+7,-25,-5,-25,25,5,25,0
next t




rem fish food
NumberOfFoods=20
FoodColor =0
for t=1 to NumberOfFoods

if FoodColor =0
r=255 : g=0
if FoodColor=1
r=255 : g=255
if FoodColor=2
r=0 : g=255
if FoodColor=3
r=255 : g=125
FoodColor = FoodColor +1
if FoodColor =4 then FoodColor =0

make object sphere t+ NumberOfFoods,50
color object t+ NumberOfFoods ,rgb(r,g,0)







if Inkey$()=""
followMe = 1 : Rem Tell the program to follow Object 1
endif



if Inkey$()="q"
for x = 1 to 100
if object exist(x) = 1 then delete object x
next x
backdrop off

endif
REM TRANSFORM OBJECTS
REM MOVE OBJECTS
REM CHECK FOR COLLISION
REM MOVE CAMERA
if followMe = 1 : Rem If the camera is following Object 1
cpZ# = Newzvalue(P1Z#,A1Y-180,200) : Rem Calculate the camera's new Z position
cpX# = Newxvalue(P1X#,A1Y-180,200) : Rem Calculate the camera's new X position
Position camera cpX#,200,cpZ# : Rem Set the camera placement
Point camera P1X#,P1Y#+50,P1Z# : Rem Point camera at the top of Object 1
endif
REM REFRESH SCREEN
]

Login to post a reply

Server time is: 2024-04-19 05:53:23
Your offset time is: 2024-04-19 05:53:23