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 / Question regarding sprites

Author
Message
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 27th Feb 2016 14:01
Hello,

I'm working on small game that works fine so far.

I have the following agc files:

1) main.agc

2) setup.agc

3) screen2.agc

The game is designed to load into main.agc, however I have fixed a sprite to the screen that I want to be 'clickable'.

main.agc is a screen that automatically scrolls when it starts.

I want this clickable sprite to activate screen2.agc, which is a replica of main.agc, with just a few differences.

when the sprite is clicked, screen2.agc is meant to show up.

So far I have been unable to achieve this in spite of going through all the tutorials.

I suspect I will #include screen.agc in the main.agc code, however, the sprites don't seem to be clickable after all my efforts.

Any ideas on how to load into another agc file within the same project ?

Thanks

isgltd (2014)
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 27th Feb 2016 18:56 Edited at: 27th Feb 2016 18:59
Quote: "Any ideas on how to load into another agc file within the same project ?"

What I suggest is to create a function inside screen2.agc to draw screen2 and call that function when a sprite is clicked.

This is not actual code, but this is the way I suggest to design it:

screen2.agc:



main.agc:

Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 27th Feb 2016 19:28 Edited at: 27th Feb 2016 19:32
Fantastic, Thanks for you help. I'll give it a go now and let you know how it goes.
isgltd (2014)
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 27th Feb 2016 19:43
Hello,

You know the "If sprite is clicked", is this meant to be replaced by the ID of the sprite ?

Many Thanks
isgltd (2014)
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 27th Feb 2016 21:29 Edited at: 27th Feb 2016 21:29
Quote: " "If sprite is clicked", is this meant to be replaced by the ID of the sprite ?"

It meant to be replaced with the commands to check if a sprite is clicked and you going to need the sprite ID for that.

For example:

BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Feb 2016 22:06
Agc files are not separate programs or levels. They can be, but it is not the best way to think about designing your program.

Each agc file in #included as you said. But you can think of all of the included files as one huge single file of code - this is how the compiler sees it.
Generally, you use separate agc files for different functions. For example, I have different agc files for effects, User Interface, Comms etc.

Zigi's advice describes how you should think about designing your program. Make different tasks into separate functions, and call them from one another. The functions can be in any of your agc files, the compiler sees them as one huge collection.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 04:16
Fantastic.

Thanks for your advice.

I'm already working on a different design model for my game.

Thanks
isgltd (2014)
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 11:09
Hello Guys,

And thanks for your feedback.

I now have a working menu screen that transitions to the main game when a sprite is clicked.

I completely redesigned the whole thing and so far it's working.

Just trying to work on a hyperlink sprite or text that opens up a webpage when clicked.

I was having problems with this too.

Thanks
isgltd (2014)
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 28th Feb 2016 11:42
Quote: "Just trying to work on a hyperlink sprite or text that opens up a webpage when clicked. I was having problems with this too. "


You can use OpenBrowser(url) command for that.

For example,

on a sprite clicked:


on text clicked
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 11:59 Edited at: 28th Feb 2016 12:08
You guys are geniuses.

So so helpful.

I really appreciate this.

I haven't used AppGameKit in a while since I purchased it. However the 2.017 update convinced me.

AGK 2 is something really special.

I was mad at it before and wouldn't use it, but recently, It's been docked to my taskbar.

My next task is to figure out how to use the particle editor.

By the way, I intend to release a few free graphic design assets to the AppGameKit group.

Free to use commercially and non-commercially in your games and projects.

These include 2D and 3D assets.

Is this allowed around here ?

Do I start a thread for it ?

It's just that I have quite a few things sitting on my hard drive and would rather give them away for free as I made more than enough assets

It's pretty useful stuff too.

Thanks
isgltd (2014)
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 12:19
Quote: "on a sprite clicked:"


Hey

I tried your code, and even tried this method here:



But it doesn't seem to be working.

Thanks
isgltd (2014)
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 28th Feb 2016 12:47 Edited at: 28th Feb 2016 12:57
Quote: "I tried your code,...But it doesn't seem to be working."


It works for me.

Try this:
https://forum.thegamecreators.com/attachment/77111

Attachments

Login to view attachments
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 12:57
Hey,

Jut tried your code.

It turns green when I hover over it, and when I press the text at the top of the window, it stays green for a few seconds but no browser opens up.

Thanks
isgltd (2014)
Zigi
14
Years of Service
User Offline
Joined: 5th Jul 2009
Location:
Posted: 28th Feb 2016 13:03
Maybe your firewall or antivirus blocking the app from opening the browser.
Check your firewall and av settings and make sure the app and AppGameKit is trusted.
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 28th Feb 2016 13:15
Hello!

I've just restarted my system, and it works P-E-R-F-E-C-T-L-Y.

It was windows 10 being the usual nightmare that it is, bit now that sorted.

I am really grateful for your solution.

Regarding the assets, what section is best to release them ? These are my own assets that I've created and wish to share.

Thanks

isgltd (2014)
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Mar 2016 10:56
The main App Game Kit board is the most read among AppGameKit users.
Thanks in advance for sharing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Sh4d0xx
9
Years of Service
User Offline
Joined: 5th Dec 2014
Location: United Kingdom
Posted: 1st Mar 2016 11:08 Edited at: 1st Mar 2016 11:28
Thanks for that @ BatVink

Now I have another rather strange problem, and I don't quite know what to make of it.

Basically my app starts at the startscreen and then goes to the main game.

Everything seems to be working fine, including the clickable text links on the startscreen.

However, when the app starts, I have the screenscrolling no problem, was able to fix sprites and text to the screen with no problems too.

The problem comes when I'm trying to make some of those text and sprites clickable.

They don't seem to respond at all.

Clickable sprites and text at the startscreen are fine. It's just when the game start, the clickable links and sprites don't work.

The source code design is implementing 'gosubs' and 'start=1' just like in the baws demo.

Any ideas ?

N.B: Something tells me a repeat block is meant to be in there somewhere. Inbetween the do Sync () Loop of the main game.

Many Thanks
isgltd (2014)

Login to post a reply

Server time is: 2024-03-29 08:54:02
Your offset time is: 2024-03-29 08:54:02