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.

AppGameKit Classic Chat / Panel Idea For AGK

Author
Message
aviles22
10
Years of Service
User Offline
Joined: 1st Dec 2013
Location: New Jersey, USA
Posted: 22nd Aug 2014 23:17
Wondering if there was a command or function for AppGameKit for creating an invisible like panel similar to Visual Studio where I can place a certain number of sprites onto and when that said panel's visibility is set to 0 then all sprites on that panel will also be hidden.

I have been doing many multiple screen apps and find it exhausting to write a function to do this. I'm not lazy, lol but just thought it would be a very cool feature. Is there something similar?
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 23rd Aug 2014 01:47
If you are requesting that then you should have the ability to set the bounding/clipping area, position, scale, depth etc of the panel. Also being able to scroll the content. It can be done in code already but I guess it would be nice to have.

aviles22
10
Years of Service
User Offline
Joined: 1st Dec 2013
Location: New Jersey, USA
Posted: 23rd Aug 2014 02:18
Anyone have an example in code?
lilpissywilly
AGK Developer
14
Years of Service
User Offline
Joined: 10th Sep 2010
Location: Office Chair
Posted: 23rd Aug 2014 09:16
You could add the IDs of the sprites you want to imagine being contained to a panel in an array, then hiding/showing will be short work.

My hovercraft is full of eels
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Aug 2014 20:55
You could also use setSpriteScissor to make sprites only draw within a set area...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Aug 2014 08:32
Can you hide sprite groups?

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th Aug 2014 11:06
No, I don't think there's a command for that. You would have to store the ID's in an array or something.
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 25th Aug 2014 12:18
If you're using V2 then use a separate image attached to a sprite for each "panel" and use SetRenderToImage() to draw sprites to it.

Then either display or hide that image/sprite depending on whether you want the panel shown or not.

It might give a performance hit, but makes it easy to do cool stuff like fade the panel in/out, scale the panel and anything drawn to it etc.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 25th Aug 2014 13:19
Maybe put some time aside and write something which provides the functionality you need, one idea would be to do something like this.

Group your game screens together in some logical way, you may call them 'scenes' or something similar.
A scene would be a user defined type which contains all relevant resources:



Instead of creating sprites in the normal way you use your own scene functions such as:



These functions add each resource to a list of some kind so group operations can be performed such as:




This is only one approach, there are many ways to address something like this, hope this gives you some ideas. I would point out that you should probably not have images as part of your scene as they often need to be shared across multiple scenes.

Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 25th Aug 2014 17:42
I like the panel concept. I will probably do something similar for my next project. The new v2 compiler will be excellent for something like this.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Aug 2014 18:49
I do what Matty H mentions, creating scenes. I have a library of resources which the scenes utilise, it's all driven by arrays which manage what is contained within the scene. A screen can contain multiple scenes.

I also use collections and groups for associated buttons, images etc. For example, a score display might be a group of 5 images (99999). Health might be 3 images (Read/Amber/Green). The two together form a HUD which is contained in a collection. I can then control individual sprites, groups or collections. Again, it's all done with arrays.

I've gone further to add effects to groups. For example, the 5 score sprites may appear with a 100ms delay between sprites. When it changes, the sprites expand by 10% and then shrink back.

The only way to achieve this level of control is to write it yourself.

Most importantly, these are all self-contained source files and functions. When I create a new project, I drop the files in and my Sprite control system is ready to use.

With the new arrays in types, this kind of stuff will be many times easier.

Login to post a reply

Server time is: 2024-11-25 07:34:43
Your offset time is: 2024-11-25 07:34:43